This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yolanda.robla
Recipients rbcollins, yolanda.robla
Date 2016-04-25.14:52:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1461595936.84.0.920210951296.issue26807@psf.upfronthosting.co.za>
In-reply-to
Content
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()
History
Date User Action Args
2016-04-25 14:52:16yolanda.roblasetrecipients: + yolanda.robla, rbcollins
2016-04-25 14:52:16yolanda.roblasetmessageid: <1461595936.84.0.920210951296.issue26807@psf.upfronthosting.co.za>
2016-04-25 14:52:16yolanda.roblalinkissue26807 messages
2016-04-25 14:52:16yolanda.roblacreate