예제 #1
0
 def testBytesOpen(self):
     # Opening a bytes filename
     try:
         fn = TESTFN.encode("ascii")
     except UnicodeEncodeError:
         # Skip test
         return
     f = self.f = _FileIO(fn, "w")
     f.write(b"abc")
     f.close()
     with open(TESTFN, "rb") as f:
         self.f = f
         self.assertEqual(f.read(), b"abc")
예제 #2
0
 def testBytesOpen(self):
     # Opening a bytes filename
     try:
         fn = TESTFN.encode("ascii")
     except UnicodeEncodeError:
         # Skip test
         return
     f = self.f = _FileIO(fn, "w")
     f.write(b"abc")
     f.close()
     with open(TESTFN, "rb") as f:
         self.f = f
         self.assertEqual(f.read(), b"abc")
예제 #3
0
 def testBytesOpen(self):
     try:
         fn = TESTFN.encode('ascii')
     except UnicodeEncodeError:
         self.skipTest('could not encode %r to ascii' % TESTFN)
     f = self.FileIO(fn, 'w')
     try:
         f.write(b'abc')
         f.close()
         with open(TESTFN, 'rb') as f:
             self.assertEqual(f.read(), b'abc')
     finally:
         os.unlink(TESTFN)
예제 #4
0
 def testBytesOpen(self):
     # Opening a bytes filename
     try:
         fn = TESTFN.encode("ascii")
     except UnicodeEncodeError:
         self.skipTest('could not encode %r to ascii' % TESTFN)
     f = self.FileIO(fn, "w")
     try:
         f.write(b"abc")
         f.close()
         with open(TESTFN, "rb") as f:
             self.assertEqual(f.read(), b"abc")
     finally:
         os.unlink(TESTFN)
예제 #5
0
 def testBytesOpen(self):
     # Opening a bytes filename
     try:
         fn = TESTFN.encode("ascii")
     except UnicodeEncodeError:
         self.skipTest('could not encode %r to ascii' % TESTFN)
     f = _FileIO(fn, "w")
     try:
         f.write(b"abc")
         f.close()
         with open(TESTFN, "rb") as f:
             self.assertEqual(f.read(), b"abc")
     finally:
         os.unlink(TESTFN)