本文整理匯總了Python中test_result.TestResult.summary方法的典型用法代碼示例。如果您正苦於以下問題:Python TestResult.summary方法的具體用法?Python TestResult.summary怎麽用?Python TestResult.summary使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類test_result.TestResult
的用法示例。
在下文中一共展示了TestResult.summary方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TestCaseTest
# 需要導入模塊: from test_result import TestResult [as 別名]
# 或者: from test_result.TestResult import summary [as 別名]
class TestCaseTest(TestCase):
def setUp(self):
self.result = TestResult()
def testTemplateMethod(self):
test = WasRun("testMethod")
test.run(self.result)
# assert("setUp " == self.test.log)
assert("setUp testMethod tearDown" == test.log)
def testResult(self):
test = WasRun("testMethod")
test.run(self.result)
assert("1 run, 0 failed" == self.result.summary() )
def testFailedResult(self):
test = WasRun("testBrokenMethod")
test.run(self.result)
assert("1 run, 1 failed" == self.result.summary() )
def testFailedResultFormatting(self):
result.testStarted()
result.testFailed()
assert("1 run, 1 failed" == self.result.summary() )
def testSuite(self):
suite = TestSuite()
suite.add(WasRun("testMethod"))
suite.add(WasRun("testBrokenMethod"))
suite.run(self.result)
assert("2 run, 1 failed" == self.result.summary() )
示例2: testFailedResult
# 需要導入模塊: from test_result import TestResult [as 別名]
# 或者: from test_result.TestResult import summary [as 別名]
def testFailedResult(self):
test = WasRun("testBrokenMethod")
test.run(self.result)
assert("1 run, 1 failed" == self.result.summary() )
def testFailedResultFormatting(self):
result.testStarted()
result.testFailed()
assert("1 run, 1 failed" == self.result.summary() )
def testSuite(self):
suite = TestSuite()
suite.add(WasRun("testMethod"))
suite.add(WasRun("testBrokenMethod"))
suite.run(self.result)
assert("2 run, 1 failed" == self.result.summary() )
suite = TestSuite()
suite.add(TestCaseTest("testTemplateMethod"))
suite.add(TestCaseTest("testResult"))
suite.add(TestCaseTest("testFailedResult"))
suite.add(TestCaseTest("testFailedResultFormatting"))
suite.add(TestCaseTest("testSuite"))
result = TestResult()
suite.run(result)
print result.summary()