MCPcopy Create free account
hub / github.com/python/cpython / test_mock_open

Method test_mock_open

Lib/test/test_unittest/testmock/testwith.py:144–150  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

142class TestMockOpen(unittest.TestCase):
143
144 def test_mock_open(self):
145 mock = mock_open()
146 with patch('%s.open' % __name__, mock, create=True) as patched:
147 self.assertIs(patched, mock)
148 open('foo')
149
150 mock.assert_called_once_with('foo')
151
152
153 def test_mock_open_context_manager(self):

Callers

nothing calls this directly

Calls 5

mock_openFunction · 0.90
patchFunction · 0.90
openFunction · 0.50
assertIsMethod · 0.45

Tested by

no test coverage detected