MCPcopy Index your code
hub / github.com/python/cpython / testBytesOpen

Method testBytesOpen

Lib/test/test_io/test_fileio.py:587–597  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

585 os.unlink(TESTFN)
586
587 def testBytesOpen(self):
588 # Opening a bytes filename
589 fn = TESTFN_ASCII.encode("ascii")
590 f = self.FileIO(fn, "w")
591 try:
592 f.write(b"abc")
593 f.close()
594 with self.open(TESTFN_ASCII, "rb") as f:
595 self.assertEqual(f.read(), b"abc")
596 finally:
597 os.unlink(TESTFN_ASCII)
598
599 @unittest.skipIf(sys.getfilesystemencoding() != 'utf-8',
600 "test only works for utf-8 filesystems")

Callers

nothing calls this directly

Calls 7

writeMethod · 0.95
closeMethod · 0.95
readMethod · 0.95
encodeMethod · 0.45
openMethod · 0.45
assertEqualMethod · 0.45
unlinkMethod · 0.45

Tested by

no test coverage detected