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

Method test_closefd_attr

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

Source from the content-addressed store, hash-verified

492 encoding="utf-8", closefd=False)
493
494 def test_closefd_attr(self):
495 with self.open(os_helper.TESTFN, "wb") as f:
496 f.write(b"egg\n")
497 with self.open(os_helper.TESTFN, "r", encoding="utf-8") as f:
498 self.assertEqual(f.buffer.raw.closefd, True)
499 file = self.open(f.fileno(), "r", encoding="utf-8", closefd=False)
500 self.assertEqual(file.buffer.raw.closefd, False)
501
502 def test_garbage_collection(self):
503 # FileIO objects are collected, and collecting them flushes

Callers

nothing calls this directly

Calls 4

openMethod · 0.45
writeMethod · 0.45
assertEqualMethod · 0.45
filenoMethod · 0.45

Tested by

no test coverage detected