當前位置: 首頁>>代碼示例>>Python>>正文


Python check.HAS_DOCUTILS屬性代碼示例

本文整理匯總了Python中distutils.command.check.HAS_DOCUTILS屬性的典型用法代碼示例。如果您正苦於以下問題:Python check.HAS_DOCUTILS屬性的具體用法?Python check.HAS_DOCUTILS怎麽用?Python check.HAS_DOCUTILS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在distutils.command.check的用法示例。


在下文中一共展示了check.HAS_DOCUTILS屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_check_restructuredtext

# 需要導入模塊: from distutils.command import check [as 別名]
# 或者: from distutils.command.check import HAS_DOCUTILS [as 別名]
def test_check_restructuredtext(self):
        if not HAS_DOCUTILS: # won't test without docutils
            return
        # let's see if it detects broken rest in long_description
        broken_rest = 'title\n===\n\ntest'
        pkg_info, dist = self.create_dist(long_description=broken_rest)
        cmd = check(dist)
        cmd.check_restructuredtext()
        self.assertEqual(cmd._warnings, 1)

        # let's see if we have an error with strict=1
        metadata = {'url': 'xxx', 'author': 'xxx',
                    'author_email': 'xxx',
                    'name': 'xxx', 'version': 'xxx',
                    'long_description': broken_rest}
        self.assertRaises(DistutilsSetupError, self._run, metadata,
                          **{'strict': 1, 'restructuredtext': 1})

        # and non-broken rest
        metadata['long_description'] = 'title\n=====\n\ntest'
        cmd = self._run(metadata, strict=1, restructuredtext=1)
        self.assertEqual(cmd._warnings, 0) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:24,代碼來源:test_check.py

示例2: test_check_restructuredtext

# 需要導入模塊: from distutils.command import check [as 別名]
# 或者: from distutils.command.check import HAS_DOCUTILS [as 別名]
def test_check_restructuredtext(self):
        if not HAS_DOCUTILS: # won't test without docutils
            return
        # let's see if it detects broken rest in long_description
        broken_rest = 'title\n===\n\ntest'
        pkg_info, dist = self.create_dist(long_description=broken_rest)
        cmd = check(dist)
        cmd.check_restructuredtext()
        self.assertEqual(cmd._warnings, 1)

        # let's see if we have an error with strict=1
        metadata = {'url': 'xxx', 'author': 'xxx',
                    'author_email': 'xxx',
                    'name': 'xxx', 'version': 'xxx',
                    'long_description': broken_rest}
        self.assertRaises(DistutilsSetupError, self._run, metadata,
                          **{'strict': 1, 'restructuredtext': 1})

        # and non-broken rest, including a non-ASCII character to test #12114
        metadata['long_description'] = u'title\n=====\n\ntest \u00df'
        cmd = self._run(metadata, strict=1, restructuredtext=1)
        self.assertEqual(cmd._warnings, 0) 
開發者ID:Acmesec,項目名稱:CTFCrackTools-V2,代碼行數:24,代碼來源:test_check.py

示例3: test_check_document

# 需要導入模塊: from distutils.command import check [as 別名]
# 或者: from distutils.command.check import HAS_DOCUTILS [as 別名]
def test_check_document(self):
        if not HAS_DOCUTILS: # won't test without docutils
            return
        pkg_info, dist = self.create_dist()
        cmd = check(dist)

        # let's see if it detects broken rest
        broken_rest = 'title\n===\n\ntest'
        msgs = cmd._check_rst_data(broken_rest)
        self.assertEqual(len(msgs), 1)

        # and non-broken rest
        rest = 'title\n=====\n\ntest'
        msgs = cmd._check_rst_data(rest)
        self.assertEqual(len(msgs), 0) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:17,代碼來源:test_check.py


注:本文中的distutils.command.check.HAS_DOCUTILS屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。