Message264177
diff --git a/Lib/unittest/test/testmock/testwith.py b/Lib/unittest/test/testmock/testwith.py index a7bee73..efe6391 100644 --- a/Lib/unittest/test/testmock/testwith.py +++ b/Lib/unittest/test/testmock/testwith.py @@ -297,5 +297,16 @@ class TestMockOpen(unittest.TestCase): self.assertEqual(handle.readline(), 'bar') + def test_readlines_after_eof(self): + # Check that readlines does not fail after the end of file + mock = mock_open(read_data='foo') + with patch('%s.open' % __name__, mock, create=True): + h = open('bar') + h.read() + h.read() + data = h.readlines() + self.assertEqual(data, []) + + if __name__ == '__main__': unittest.main() | |
| Date | User | Action | Args | | 2016-04-25 14:52:16 | yolanda.robla | set | recipients: + yolanda.robla, rbcollins | | 2016-04-25 14:52:16 | yolanda.robla | set | messageid: <1461595936.84.0.920210951296.issue26807@psf.upfronthosting.co.za> | | 2016-04-25 14:52:16 | yolanda.robla | link | issue26807 messages | | 2016-04-25 14:52:16 | yolanda.robla | create | | |