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


Python unittest.main函数代码示例

本文整理汇总了Python中tests.aspects.unittest.main函数的典型用法代码示例。如果您正苦于以下问题:Python main函数的具体用法?Python main怎么用?Python main使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了main函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: LiteralTests

            """__unicode__ should return type unicode."""
            self.assertIsInstance(self.object_under_test.__unicode__(), UnicodeType)


class LiteralTests(Shared.SparqlNodeTests):
    """Tests for sparql.Literal."""

    net = False
    object_under_test = sparql.Literal({'datatype': '', 'lang': 'en', 'value': 'value'})


class BnodeTests(Shared.SparqlNodeTests):
    """Tests for sparql.Bnode."""

    net = False
    object_under_test = sparql.Bnode({'value': 'Foo'})


class URITests(Shared.SparqlNodeTests):
    """Tests for sparql.URI."""

    net = False
    object_under_test = sparql.URI({'value': 'http://foo.com'}, 'http://bar.com')


if __name__ == '__main__':  # pragma: no cover
    try:
        unittest.main()
    except SystemExit:
        pass
开发者ID:magul,项目名称:pywikibot-core,代码行数:30,代码来源:sparql_tests.py

示例2: TestPwb

class TestPwb(PwbTestCase):

    """
    Test pwb.py functionality.

    This is registered as a Site test because it will not run
    without a user-config.py
    """

    # site must be explicitly set for pwb tests. This test does not require
    # network access, because tests/pwb/print_locals.py does not use
    # handle_args, etc. so version.py doesnt talk on the network.
    site = False
    net = False

    def testScriptEnvironment(self):
        """
        Test environment of pywikibot.

        Make sure the environment is not contaminated, and is the same as
        the environment we get when directly running a script.
        """
        direct = execute([sys.executable, '-m', 'tests.pwb.print_locals'])
        vpwb = execute_pwb([print_locals_test_script])
        self.maxDiff = None
        self.assertEqual(direct['stdout'], vpwb['stdout'])

if __name__ == "__main__":
    unittest.main(verbosity=10)
开发者ID:skamithi,项目名称:pywikibot-core,代码行数:29,代码来源:pwb_tests.py


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