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

Method test_with_open

Lib/test/test_io/test_general.py:359–370  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

357 self.large_file_ops(f)
358
359 def test_with_open(self):
360 for bufsize in (0, 100):
361 with self.open(os_helper.TESTFN, "wb", bufsize) as f:
362 f.write(b"xxx")
363 self.assertEqual(f.closed, True)
364 try:
365 with self.open(os_helper.TESTFN, "wb", bufsize) as f:
366 1/0
367 except ZeroDivisionError:
368 self.assertEqual(f.closed, True)
369 else:
370 self.fail("1/0 didn't raise an exception")
371
372 # issue 5008
373 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