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

Method test_with_open

Lib/test/test_io.py:664–675  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

662 self.large_file_ops(f)
663
664 def test_with_open(self):
665 for bufsize in (0, 100):
666 with self.open(os_helper.TESTFN, "wb", bufsize) as f:
667 f.write(b"xxx")
668 self.assertEqual(f.closed, True)
669 try:
670 with self.open(os_helper.TESTFN, "wb", bufsize) as f:
671 1/0
672 except ZeroDivisionError:
673 self.assertEqual(f.closed, True)
674 else:
675 self.fail("1/0 didn't raise an exception")
676
677 # issue 5008
678 def test_append_mode_tell(self):

Callers

nothing calls this directly

Calls 4

openMethod · 0.45
writeMethod · 0.45
assertEqualMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected