diff options
Diffstat (limited to 'test.py')
-rwxr-xr-x | test.py | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -3984,20 +3984,21 @@ class PatcherTest(TestCase): self.assertRaises(AssertionError, obj.method) def test_original_exception_raised(self): - class MyClass(object): - def non_existing_attribute(self): + class C(object): + def use_non_existing_attribute(self): return self.bad_attribute - mock_class = self.mocker.patch(MyClass) - mock_class.run() + mock = self.mocker.patch(C) + mock.any_other_method() self.mocker.replay() - my_class = MyClass() + obj = C() try: - my_class.non_existing_attribute() + obj.use_non_existing_attribute() except AttributeError, error: - message = "'MyClass' object has no attribute 'bad_attribute'" + message = "'C' object has no attribute 'bad_attribute'" self.assertEquals(message, error.message) + def main(): try: unittest.main() |