当前位置: 首页>>代码示例>>Python>>正文


Python mailcap.getcaps方法代码示例

本文整理汇总了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) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:18,代码来源:test_mailcap.py

示例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) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:10,代码来源:test_mailcap.py

示例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'] 
开发者ID:tildeclub,项目名称:ttrv,代码行数:17,代码来源:terminal.py


注:本文中的mailcap.getcaps方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。