當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。