diff options
author | achapp <adamdchappell@gmail.com> | 2014-11-25 13:23:15 -0600 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2014-12-17 15:51:19 -0800 |
commit | b2f45f90350b46e69ebb677cb040b916c95fbc34 (patch) | |
tree | 05e14360f76d95d65918872103d692fca152736c /tests/test_file.py | |
parent | 0a5485390d43f408b130011ae3452855e766786d (diff) |
Refactoring
Added comments. Removed fifth line from test because it was unnecessary
since the final line could be used instead.
Diffstat (limited to 'tests/test_file.py')
-rwxr-xr-x | tests/test_file.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/test_file.py b/tests/test_file.py index 044dc591..a6ff69e9 100755 --- a/tests/test_file.py +++ b/tests/test_file.py @@ -70,16 +70,17 @@ class BufferedFileTest (unittest.TestCase): def test_2_readline(self): f = LoopbackFile('r+U') - f.write(b'First line.\nSecond line.\r\nThird line.\nFourth line.\nFifth line.\nFinal line non-terminated.') + f.write(b'First line.\nSecond line.\r\nThird line.\n' + + b'Fourth line.\nFinal line non-terminated.') + self.assertEqual(f.readline(), 'First line.\n') # universal newline mode should convert this linefeed: self.assertEqual(f.readline(), 'Second line.\n') # truncated line: self.assertEqual(f.readline(7), 'Third l') self.assertEqual(f.readline(), 'ine.\n') - # readline should not read past the fourth line - self.assertEqual(f.readline(25), 'Fourth line.\n') - self.assertEqual(f.readline(), 'Fifth line.\n') + # newline should be detected and only the fourth line returned + self.assertEqual(f.readline(39), 'Fourth line.\n') self.assertEqual(f.readline(), 'Final line non-terminated.') self.assertEqual(f.readline(), '') f.close() |