MCPcopy Index your code
hub / github.com/RustPython/RustPython / testBytesOpen

Method testBytesOpen

Lib/test/test_fileio.py:588–598  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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