diff options
author | Robert Collins <rbtcollins@hp.com> | 2015-07-17 20:08:45 +1200 |
---|---|---|
committer | Robert Collins <rbtcollins@hp.com> | 2015-07-17 21:09:21 +1200 |
commit | e9db0161fc11eceba189a0cc161deefce57529a8 (patch) | |
tree | ab0e6fc154ec00300d51c7689b777164d0ae1c9c /mock/tests/testmock.py | |
parent | 5c57dd2b9ef71366f302f91693a2e5c290aa473b (diff) | |
download | mock-e9db0161fc11eceba189a0cc161deefce57529a8.tar.gz |
Issue #21750: mock_open.read_data can now be read from each instance, as it
could in Python 3.3.
Diffstat (limited to 'mock/tests/testmock.py')
-rw-r--r-- | mock/tests/testmock.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/mock/tests/testmock.py b/mock/tests/testmock.py index 4be8779..88f94f3 100644 --- a/mock/tests/testmock.py +++ b/mock/tests/testmock.py @@ -1436,6 +1436,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: |