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


Python unittest2.TextTestResult方法代码示例

本文整理汇总了Python中unittest2.TextTestResult方法的典型用法代码示例。如果您正苦于以下问题:Python unittest2.TextTestResult方法的具体用法?Python unittest2.TextTestResult怎么用?Python unittest2.TextTestResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在unittest2的用法示例。


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

示例1: test_tracebacks

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import TextTestResult [as 别名]
def test_tracebacks(self):
        @patch.object(Foo, 'f', object())
        def test():
            raise AssertionError
        try:
            test()
        except:
            err = sys.exc_info()

        result = unittest.TextTestResult(None, None, 0)
        traceback = result._exc_info_to_string(err, self)
        self.assertIn('raise AssertionError', traceback) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:14,代码来源:testpatch.py

示例2: test_init

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import TextTestResult [as 别名]
def test_init(self):
        runner = unittest2.TextTestRunner()
        self.assertFalse(runner.failfast)
        self.assertFalse(runner.buffer)
        self.assertEqual(runner.verbosity, 1)
        self.assertTrue(runner.descriptions)
        self.assertEqual(runner.resultclass, unittest2.TextTestResult) 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:9,代码来源:test_runner.py

示例3: testInheritance

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import TextTestResult [as 别名]
def testInheritance(self):
        self.assertIsSubclass(unittest2.TestCase, unittest.TestCase)
        self.assertIsSubclass(unittest2.TestResult, unittest.TestResult)
        self.assertIsSubclass(unittest2.TestSuite, unittest.TestSuite)
        self.assertIsSubclass(unittest2.TextTestRunner, unittest.TextTestRunner)
        self.assertIsSubclass(unittest2.TestLoader, unittest.TestLoader)
        self.assertIsSubclass(unittest2.TextTestResult, unittest.TestResult) 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:9,代码来源:test_new_tests.py

示例4: testGetDescriptionWithoutDocstring

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import TextTestResult [as 别名]
def testGetDescriptionWithoutDocstring(self):
        result = unittest2.TextTestResult(None, True, 1)
        self.assertEqual(
                result.getDescription(self),
                'testGetDescriptionWithoutDocstring (' + __name__ +
                '.Test_TestResult)') 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:8,代码来源:test_result.py

示例5: testGetDescriptionWithOneLineDocstring

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import TextTestResult [as 别名]
def testGetDescriptionWithOneLineDocstring(self):
        """Tests getDescription() for a method with a docstring."""
        result = unittest2.TextTestResult(None, True, 1)
        self.assertEqual(
                result.getDescription(self),
               ('testGetDescriptionWithOneLineDocstring '
                '(' + __name__ + '.Test_TestResult)\n'
                'Tests getDescription() for a method with a docstring.')) 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:10,代码来源:test_result.py

示例6: testGetDescriptionWithMultiLineDocstring

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import TextTestResult [as 别名]
def testGetDescriptionWithMultiLineDocstring(self):
        """Tests getDescription() for a method with a longer docstring.
        The second line of the docstring.
        """
        result = unittest2.TextTestResult(None, True, 1)
        self.assertEqual(
                result.getDescription(self),
               ('testGetDescriptionWithMultiLineDocstring '
                '(' + __name__ + '.Test_TestResult)\n'
                'Tests getDescription() for a method with a longer '
                'docstring.')) 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:13,代码来源:test_result.py


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