Yolanda added the comment:
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()
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26807>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com