本文整理汇总了Python中mailcap.getcaps方法的典型用法代码示例。如果您正苦于以下问题:Python mailcap.getcaps方法的具体用法?Python mailcap.getcaps怎么用?Python mailcap.getcaps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mailcap
的用法示例。
在下文中一共展示了mailcap.getcaps方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_system_mailcap
# 需要导入模块: import mailcap [as 别名]
# 或者: from mailcap import getcaps [as 别名]
def test_system_mailcap(self):
# Test mailcap.getcaps() with mailcap file(s) on system, if any.
caps = mailcap.getcaps()
self.assertIsInstance(caps, dict)
mailcapfiles = mailcap.listmailcapfiles()
existingmcfiles = [mcf for mcf in mailcapfiles if os.path.exists(mcf)]
if existingmcfiles:
# At least 1 mailcap file exists, so test that.
for (k, v) in caps.items():
self.assertIsInstance(k, str)
self.assertIsInstance(v, list)
for e in v:
self.assertIsInstance(e, dict)
else:
# No mailcap files on system. getcaps() should return empty dict.
self.assertEqual({}, caps)
示例2: test_mock_getcaps
# 需要导入模块: import mailcap [as 别名]
# 或者: from mailcap import getcaps [as 别名]
def test_mock_getcaps(self):
# Test mailcap.getcaps() using mock mailcap file in this dir.
# Temporarily override any existing system mailcap file by pointing the
# MAILCAPS environment variable to our mock file.
with test.support.EnvironmentVarGuard() as env:
env["MAILCAPS"] = MAILCAPFILE
caps = mailcap.getcaps()
self.assertDictEqual(caps, MAILCAPDICT)
示例3: __init__
# 需要导入模块: import mailcap [as 别名]
# 或者: from mailcap import getcaps [as 别名]
def __init__(self, stdscr, config):
self.stdscr = stdscr
self.config = config
self.loader = LoadScreen(self)
self.theme = None # Initialized by term.set_theme()
self.theme_list = ThemeList()
self._display = None
self._mailcap_dict = mailcap.getcaps()
self._term = os.environ.get('TERM')
# This is a hack, the MIME parsers should be stateless
# but we need to load the imgur credentials from the config
mime_parsers.ImgurApiMIMEParser.CLIENT_ID = config['imgur_client_id']