本文整理汇总了Python中green.result.ProtoTestResult.addUnexpectedSuccess方法的典型用法代码示例。如果您正苦于以下问题:Python ProtoTestResult.addUnexpectedSuccess方法的具体用法?Python ProtoTestResult.addUnexpectedSuccess怎么用?Python ProtoTestResult.addUnexpectedSuccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类green.result.ProtoTestResult
的用法示例。
在下文中一共展示了ProtoTestResult.addUnexpectedSuccess方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_addUnexpectedSuccess
# 需要导入模块: from green.result import ProtoTestResult [as 别名]
# 或者: from green.result.ProtoTestResult import addUnexpectedSuccess [as 别名]
def test_addUnexpectedSuccess(self):
"""
addUnexpectedSuccess adds a test correctly
"""
ptr = ProtoTestResult()
test = proto_test(MagicMock())
ptr.addUnexpectedSuccess(test)
self.assertEqual(test, ptr.unexpectedSuccesses[0])
示例2: test_addProtoTestResult
# 需要导入模块: from green.result import ProtoTestResult [as 别名]
# 或者: from green.result.ProtoTestResult import addUnexpectedSuccess [as 别名]
def test_addProtoTestResult(self):
"""
addProtoTestResult adds the correct things to the correct places.
"""
ptr = ProtoTestResult()
err_t = proto_test(MagicMock())
try:
raise Exception
except:
err_e = proto_error(sys.exc_info())
ptr.addError(err_t, err_e)
ef_t = proto_test(MagicMock())
try:
raise Exception
except:
ef_e = proto_error(sys.exc_info())
ptr.addExpectedFailure(ef_t, ef_e)
fail_t = proto_test(MagicMock())
try:
raise Exception
except:
fail_e = proto_error(sys.exc_info())
ptr.addFailure(fail_t, fail_e)
pass_t = proto_test(MagicMock())
ptr.addSuccess(pass_t)
skip_t = proto_test(MagicMock())
skip_r = proto_test(MagicMock())
ptr.addSkip(skip_t, skip_r)
us_t = proto_test(MagicMock())
ptr.addUnexpectedSuccess(us_t)
self.args.verbose = 0
gtr = GreenTestResult(self.args, GreenStream(self.stream))
gtr.addProtoTestResult(ptr)
self.assertEqual(gtr.errors, [(err_t, err_e)])
self.assertEqual(gtr.expectedFailures, [(ef_t, ef_e)])
self.assertEqual(gtr.failures, [(fail_t, fail_e)])
self.assertEqual(gtr.passing, [pass_t])
self.assertEqual(gtr.skipped, [(skip_t, skip_r)])
self.assertEqual(gtr.unexpectedSuccesses, [us_t])