mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Fix exception when calling reset_mock on a mock created with autospec
This commit is contained in:
parent
afc0c77b42
commit
75963643b1
3 changed files with 18 additions and 0 deletions
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue