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

Method test_opener

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

Source from the content-addressed store, hash-verified

640 self.assertHasAttr(obj, "__dict__")
641
642 def test_opener(self):
643 with self.open(os_helper.TESTFN, "w", encoding="utf-8") as f:
644 f.write("egg\n")
645 fd = os.open(os_helper.TESTFN, os.O_RDONLY)
646 def opener(path, flags):
647 return fd
648 with self.open("non-existent", "r", encoding="utf-8", opener=opener) as f:
649 self.assertEqual(f.read(), "egg\n")
650
651 def test_bad_opener_negative_1(self):
652 # Issue #27066.

Callers

nothing calls this directly

Calls 4

openMethod · 0.45
writeMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected