66
77
88class TestCaseTest (TestCase ):
9+ def setUp (self ) -> None :
10+ self .result = TestResult ()
11+
912 def testTemplateMethod (self ) -> None :
1013 test = WasRun ("testMethod" )
11- result = TestResult ()
12- test .run (result )
13- assert ("1 run, 0 failed" == result .summary ())
14+ test .run (self .result )
15+ assert ("1 run, 0 failed" == self .result .summary ())
1416
1517 def testFailedResult (self ) -> None :
1618 test = WasRun ("testBrokenMethod" )
17- result = TestResult ()
18- test .run (result )
19- assert ("1 run, 1 failed" == result .summary ())
19+ test .run (self .result )
20+ assert ("1 run, 1 failed" == self .result .summary ())
2021
2122 def testFailedResultFormatting (self ) -> None :
2223 result = TestResult ()
@@ -26,17 +27,15 @@ def testFailedResultFormatting(self) -> None:
2627
2728 def testFailedSetUp (self ) -> None :
2829 test = TestCaseWithBrokenSetup ("testMethod" )
29- result = TestResult ()
30- test .run (result )
31- assert ("1 run, 1 failed" == result .summary ())
30+ test .run (self .result )
31+ assert ("1 run, 1 failed" == self .result .summary ())
3232
3333 def testSuite (self ) -> None :
3434 suite = TestSuite ()
3535 suite .add (WasRun ("testMethod" ))
3636 suite .add (WasRun ("testBrokenMethod" ))
37- result = TestResult ()
38- suite .run (result )
39- assert ("2 run, 1 failed" == result .summary ())
37+ suite .run (self .result )
38+ assert ("2 run, 1 failed" == self .result .summary ())
4039
4140
4241suite = TestSuite ()
0 commit comments