@@ -591,7 +591,7 @@ def testBytesOpen(self):
591
591
try :
592
592
f .write (b"abc" )
593
593
f .close ()
594
- with open (TESTFN_ASCII , "rb" ) as f :
594
+ with self . open (TESTFN_ASCII , "rb" ) as f :
595
595
self .assertEqual (f .read (), b"abc" )
596
596
finally :
597
597
os .unlink (TESTFN_ASCII )
@@ -608,7 +608,7 @@ def testUtf8BytesOpen(self):
608
608
try :
609
609
f .write (b"abc" )
610
610
f .close ()
611
- with open (TESTFN_UNICODE , "rb" ) as f :
611
+ with self . open (TESTFN_UNICODE , "rb" ) as f :
612
612
self .assertEqual (f .read (), b"abc" )
613
613
finally :
614
614
os .unlink (TESTFN_UNICODE )
@@ -692,13 +692,13 @@ def bug801631():
<
8000
/tr>692
692
693
693
def testAppend (self ):
694
694
try :
695
- f = open (TESTFN , 'wb' )
695
+ f = self . FileIO (TESTFN , 'wb' )
696
696
f .write (b'spam' )
697
697
f .close ()
698
- f = open (TESTFN , 'ab' )
698
+ f = self . FileIO (TESTFN , 'ab' )
699
699
f .write (b'eggs' )
700
700
f .close ()
701
- f = open (TESTFN , 'rb' )
701
+ f = self . FileIO (TESTFN , 'rb' )
702
702
d = f .read ()
703
703
f .close ()
704
704
self .assertEqual (d , b'spameggs' )
@@ -734,6 +734,7 @@ def __setattr__(self, name, value):
734
734
class COtherFileTests (OtherFileTests , unittest .TestCase ):
735
735
FileIO = _io .FileIO
736
736
modulename = '_io'
737
+ open = _io .open
737
738
738
739
@cpython_only
739
740
def testInvalidFd_overflow (self ):
@@ -755,6 +756,7 @@ def test_open_code(self):
755
756
class PyOtherFileTests (OtherFileTests , unittest .TestCase ):
756
757
FileIO = _pyio .FileIO
757
758
modulename = '_pyio'
759
+ open = _pyio .open
758
760
759
761
def test_open_code (self ):
760
762
# Check that the default behaviour of open_code matches
0 commit comments