当前位置: 首页>>代码示例>>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;未经允许,请勿转载。