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

Method test_opener

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

Source from the content-addressed store, hash-verified

923 self.assertHasAttr(obj, "__dict__")
924
925 def test_opener(self):
926 with self.open(os_helper.TESTFN, "w", encoding="utf-8") as f:
927 f.write("egg\n")
928 fd = os.open(os_helper.TESTFN, os.O_RDONLY)
929 def opener(path, flags):
930 return fd
931 with self.open("non-existent", "r", encoding="utf-8", opener=opener) as f:
932 self.assertEqual(f.read(), "egg\n")
933
934 def test_bad_opener_negative_1(self):
935 # 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