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


Python unittest2.expectedFailure方法代码示例

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


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

示例1: test_unexpected_success_test

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import expectedFailure [as 别名]
def test_unexpected_success_test(self):
        class Succeeds(unittest.TestCase):
            def test_me(self):
                pass
            try:
                test_me = unittest.expectedFailure(test_me)
            except AttributeError:
                pass # Older python - just let the test pass
        self.result.startTestRun()
        Succeeds("test_me").run(self.result)
        self.result.stopTestRun()
        output = self.get_output()
        expected = """<testsuite errors="0" failures="1" name="" tests="1" time="0.000">
<testcase classname="junitxml.tests.test_junitxml.Succeeds" name="test_me" time="0.000">
<failure type="unittest.case._UnexpectedSuccess"/>
</testcase>
</testsuite>
"""
        expected_old = """<testsuite errors="0" failures="0" name="" tests="1" time="0.000">
<testcase classname="junitxml.tests.test_junitxml.Succeeds" name="test_me" time="0.000"/>
</testsuite>
"""
        if output != expected_old:
            self.assertEqual(expected, output) 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:26,代码来源:test_junitxml.py

示例2: test_old_testresult

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import expectedFailure [as 别名]
def test_old_testresult(self):
        class Test(unittest2.TestCase):
            def testSkip(self):
                self.skipTest('foobar')
            def testExpectedFail(self):
                raise TypeError
            testExpectedFail = unittest2.expectedFailure(testExpectedFail)
            def testUnexpectedSuccess(self):
                pass
            testUnexpectedSuccess = unittest2.expectedFailure(testUnexpectedSuccess)
        
        for test_name, should_pass in (('testSkip', True), 
                                       ('testExpectedFail', True), 
                                       ('testUnexpectedSuccess', False)):
            test = Test(test_name)
            self.assertOldResultWarning(test, int(not should_pass)) 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:18,代码来源:test_unittest2_with.py

示例3: anticipate_failure

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import expectedFailure [as 别名]
def anticipate_failure(condition):
    """Decorator to mark a test that is known to be broken in some cases

       Any use of this decorator should have a comment identifying the
       associated tracker issue.
    """
    if condition:
        return unittest.expectedFailure
    return lambda f: f 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:11,代码来源:support.py

示例4: expectedFailurePY3

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import expectedFailure [as 别名]
def expectedFailurePY3(func):
    if not PY3:
        return func
    return unittest.expectedFailure(func) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:6,代码来源:base.py

示例5: expectedFailurePY26

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import expectedFailure [as 别名]
def expectedFailurePY26(func):
    if not PY26:
        return func
    return unittest.expectedFailure(func) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:6,代码来源:base.py

示例6: expectedFailurePY27

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import expectedFailure [as 别名]
def expectedFailurePY27(func):
    if not PY27:
        return func
    return unittest.expectedFailure(func) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:6,代码来源:base.py

示例7: expectedFailurePY2

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import expectedFailure [as 别名]
def expectedFailurePY2(func):
    if not PY2:
        return func
    return unittest.expectedFailure(func)


# Renamed in Py3.3: 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:9,代码来源:base.py


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