Exemplo 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")
Exemplo 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")
Exemplo n.º 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)
Exemplo 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 = 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)
Exemplo n.º 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)