]> granicus.if.org Git - python/commitdiff
Correct and improve comments in test_fileinput (closes #20501).
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 3 Mar 2014 19:16:27 +0000 (21:16 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 3 Mar 2014 19:16:27 +0000 (21:16 +0200)
Thanks Vajrasky Kok and Zachary Ware.

Lib/test/test_fileinput.py

index 5e83a2aa25dab1a38f745d99dace2366e75f252a..c15ad847bbc3fb0083157499548cee78268b8023 100644 (file)
@@ -228,6 +228,8 @@ class FileInputTests(unittest.TestCase):
         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 @@ class Test_hook_encoded(unittest.TestCase):
     """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):