本文整理匯總了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']