summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unittest
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-05-30 07:36:22 (GMT)
committerGitHub <noreply@github.com>2023-05-30 07:36:22 (GMT)
commit219f01b18574469f493a3d3cb91d96c2f057218c (patch)
treec0124865faefeabe8ee8db420ac1f0e0a028de5d /Lib/test/test_unittest
parent5454db4ace66018179f034fbffcea8d791d66a98 (diff)
downloadcpython-219f01b18574469f493a3d3cb91d96c2f057218c.zip
cpython-219f01b18574469f493a3d3cb91d96c2f057218c.tar.gz
cpython-219f01b18574469f493a3d3cb91d96c2f057218c.tar.bz2
gh-83403: Test `parent` param in `Mock.__init__` (#103630)
Diffstat (limited to 'Lib/test/test_unittest')
-rw-r--r--Lib/test/test_unittest/testmock/testmock.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_unittest/testmock/testmock.py b/Lib/test/test_unittest/testmock/testmock.py
index c7895e7..bb09913 100644
--- a/Lib/test/test_unittest/testmock/testmock.py
+++ b/Lib/test/test_unittest/testmock/testmock.py
@@ -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()