Example #1
0
 def test_first_one(self):
     r1 = ReporterForTesting(True)
     r2 = ReporterForTesting(False)
     first = FirstWorkingReporter(r1, r2)
     success = first.report('a.txt', 'b.txt')
     self.assertTrue(r1.called)
     self.assertTrue(success)
     self.assertFalse(r2.called)
Example #2
0
 def test_second_one(self):
     r1 = TestReporter(False)
     r2 = TestReporter(False)
     first = FirstWorkingReporter(r1, r2)
     success = first.report('a.txt', 'b.txt')
     self.assertTrue(r1.called)
     self.assertTrue(r2.called)
     self.assertFalse(success)
Example #3
0
 def test_second_one(self) -> None:
     r1 = ReporterForTesting(False)
     r2 = ReporterForTesting(False)
     first = FirstWorkingReporter(r1, r2)
     success = first.report("a.txt", "b.txt")
     self.assertTrue(r1.called)
     self.assertTrue(r2.called)
     self.assertFalse(success)
 def test_second_one(self):
     r1 = TestReporter(False)
     r2 = TestReporter(False)
     first = FirstWorkingReporter(r1, r2)
     success = first.report('a.txt', 'b.txt')
     self.assertTrue(r1.called)
     self.assertTrue(r2.called)
     self.assertFalse(success)
Example #5
0
 def test_exception(self):
     def exception():
         raise Exception()
     r1 = ReporterForTesting(False, exception)
     r2 = ReporterForTesting(False)
     first = FirstWorkingReporter(r1, r2)
     success = first.report('a.txt', 'b.txt')
     self.assertTrue(r1.called)
     self.assertTrue(r2.called)
     self.assertFalse(success)
 def test_exception(self):
     def exception():
         raise Exception()
     r1 = TestReporter(False, exception)
     r2 = TestReporter(False)
     first = FirstWorkingReporter(r1, r2)
     success = first.report('a.txt', 'b.txt')
     self.assertTrue(r1.called)
     self.assertTrue(r2.called)
     self.assertFalse(success)
Example #7
0
 def test_string_representation(self) -> None:
     r1 = ReporterForTesting(True)
     r2 = ReporterForTesting(False)
     first = FirstWorkingReporter(r1, r2)
     expected = (
         "FirstWorkingReporter(ReporterForTesting(True), ReporterForTesting(False))"
     )
     self.assertEqual(expected, str(first))