mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Issue #21750: mock_open.read_data can now be read from each instance, as it
could in Python 3.3.
This commit is contained in:
commit
4838717b53
4 changed files with 57 additions and 31 deletions
|
@ -1371,6 +1371,11 @@ class MockTest(unittest.TestCase):
|
|||
self.assertEqual(m.mock_calls, [call.__int__(), call.__float__()])
|
||||
self.assertEqual(m.method_calls, [])
|
||||
|
||||
def test_mock_open_reuse_issue_21750(self):
|
||||
mocked_open = mock.mock_open(read_data='data')
|
||||
f1 = mocked_open('a-name')
|
||||
f2 = mocked_open('another-name')
|
||||
self.assertEqual(f1.read(), f2.read())
|
||||
|
||||
def test_mock_parents(self):
|
||||
for Klass in Mock, MagicMock:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue