diff options
author | Michael Foord <michael@voidspace.org.uk> | 2012-06-09 17:31:59 +0100 |
---|---|---|
committer | Michael Foord <michael@voidspace.org.uk> | 2012-06-09 17:31:59 +0100 |
commit | 75963643b178f9d72d3b6bb02d136d67c9cc6d3e (patch) | |
tree | bfb5554802f021c2686f505120312f87bf09574d /Lib/unittest/test/testmock/testmagicmethods.py | |
parent | afc0c77b421baf8ac2376e563dd9be25e1e1eb63 (diff) | |
download | cpython-75963643b178f9d72d3b6bb02d136d67c9cc6d3e.tar.gz cpython-75963643b178f9d72d3b6bb02d136d67c9cc6d3e.zip |
Fix exception when calling reset_mock on a mock created with autospec
Diffstat (limited to 'Lib/unittest/test/testmock/testmagicmethods.py')
-rw-r--r-- | Lib/unittest/test/testmock/testmagicmethods.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testmagicmethods.py b/Lib/unittest/test/testmock/testmagicmethods.py index bd52e2589b9..2bcf08801e4 100644 --- a/Lib/unittest/test/testmock/testmagicmethods.py +++ b/Lib/unittest/test/testmock/testmagicmethods.py @@ -345,6 +345,14 @@ class TestMockingMagicMethods(unittest.TestCase): self.assertEqual(mock[1][2][3], 3) + def test_magic_method_reset_mock(self): + mock = MagicMock() + str(mock) + self.assertTrue(mock.__str__.called) + mock.reset_mock() + self.assertFalse(mock.__str__.called) + + def test_dir(self): # overriding the default implementation for mock in Mock(), MagicMock(): |