bpo-44185: Added close() to mock_open __exit__ (#26902)

This commit is contained in:
Samet YASLAN 2023-06-11 20:51:21 +02:00 committed by GitHub
parent 18d16e93b6
commit 3f7c0810f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View file

@ -158,7 +158,7 @@ class TestMockOpen(unittest.TestCase):
f.read()
expected_calls = [call('foo'), call().__enter__(), call().read(),
call().__exit__(None, None, None)]
call().__exit__(None, None, None), call().close()]
self.assertEqual(mock.mock_calls, expected_calls)
self.assertIs(f, handle)
@ -172,9 +172,9 @@ class TestMockOpen(unittest.TestCase):
expected_calls = [
call('foo'), call().__enter__(), call().read(),
call().__exit__(None, None, None),
call().__exit__(None, None, None), call().close(),
call('bar'), call().__enter__(), call().read(),
call().__exit__(None, None, None)]
call().__exit__(None, None, None), call().close()]
self.assertEqual(mock.mock_calls, expected_calls)
def test_explicit_mock(self):