Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 3
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)
Ejemplo n.º 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 = _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)