mirror of
https://github.com/python/cpython.git
synced 2025-08-19 08:11:46 +00:00
gh-83403: Test parent
param in Mock.__init__
(#103630)
This commit is contained in:
parent
5454db4ace
commit
219f01b185
1 changed files with 8 additions and 0 deletions
|
@ -245,6 +245,14 @@ class MockTest(unittest.TestCase):
|
|||
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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue