File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -269,9 +269,12 @@ def test_readline(self):
269269
270270 with FileInput (files = TESTFN ,
271271 openhook = hook_encoded ('ascii' ), bufsize = 8 ) as fi :
272- self .assertEqual (fi .readline (), 'A\n ' )
273- self .assertEqual (fi .readline (), 'B\n ' )
274- self .assertEqual (fi .readline (), 'C\n ' )
272+ try :
273+ self .assertEqual (fi .readline (), 'A\n ' )
274+ self .assertEqual (fi .readline (), 'B\n ' )
275+ self .assertEqual (fi .readline (), 'C\n ' )
276+ except UnicodeDecodeError :
277+ self .fail ('Read to end of file' )
275278 with self .assertRaises (UnicodeDecodeError ):
276279 # Read to the end of file.
277280 list (fi )
@@ -854,8 +857,8 @@ def test(self):
854857 self .assertFalse (kwargs )
855858
856859 def test_modes (self ):
857- # Unlikely UTF-7 is locale encoding
858860 with open (TESTFN , 'wb' ) as f :
861+ # UTF-7 is a convenient, seldom used encoding
859862 f .write (b'A\n B\r \n C\r D+IKw-' )
860863 self .addCleanup (safe_unlink , TESTFN )
861864
You can’t perform that action at this time.
0 commit comments