[Python-checkins] cpython (2.7): Correct and improve comments in test_fileinput (closes #20501).

serhiy.storchaka python-checkins at python.org
Mon Mar 3 20:21:11 CET 2014


http://hg.python.org/cpython/rev/d37f963394aa
changeset:   89468:d37f963394aa
branch:      2.7
parent:      89449:893c9e441cd7
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Mon Mar 03 21:16:27 2014 +0200
summary:
  Correct and improve comments in test_fileinput (closes #20501).
Thanks Vajrasky Kok and Zachary Ware.

files:
  Lib/test/test_fileinput.py |  6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py
--- a/Lib/test/test_fileinput.py
+++ b/Lib/test/test_fileinput.py
@@ -228,6 +228,8 @@
         self.addCleanup(safe_unlink, TESTFN)
 
         fi = FileInput(files=TESTFN, openhook=hook_encoded('ascii'), bufsize=8)
+        # The most likely failure is a UnicodeDecodeError due to the entire
+        # file being read when it shouldn't have been.
         self.assertEqual(fi.readline(), u'A\n')
         self.assertEqual(fi.readline(), u'B\r\n')
         self.assertEqual(fi.readline(), u'C\r')
@@ -240,11 +242,9 @@
     """Unit tests for fileinput.hook_encoded()"""
 
     def test_modes(self):
-        # Unlikely UTF-7 is locale encoding
         with open(TESTFN, 'wb') as f:
+            # UTF-7 is a convenient, seldom used encoding
             f.write('A\nB\r\nC\rD+IKw-')
-        t1 = TESTFN
-        #t1 = writeTmp(1, ['A\nB\r\nC\rD+IKw-'], mode='wb')
         self.addCleanup(safe_unlink, TESTFN)
 
         def check(mode, expected_lines):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list