Skip to content

Commit

Permalink
pythongh-83403: Test parent param in Mock.__init__ (python#103630)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored May 30, 2023
1 parent 5454db4 commit 219f01b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Lib/test/test_unittest/testmock/testmock.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,14 @@ class B(object):
with mock.patch('builtins.open', mock.mock_open()):
mock.mock_open() # should still be valid with open() mocked

def test_explicit_parent(self):
parent = Mock()
mock1 = Mock(parent=parent, return_value=None)
mock1(1, 2, 3)
mock2 = Mock(parent=parent, return_value=None)
mock2(4, 5, 6)

self.assertEqual(parent.mock_calls, [call(1, 2, 3), call(4, 5, 6)])

def test_reset_mock(self):
parent = Mock()
Expand Down

0 comments on commit 219f01b

Please sign in to comment.