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

Method test_open

Lib/test/test_zipfile/_path/test_path.py:136–144  ·  view source on GitHub ↗
(self, alpharep)

Source from the content-addressed store, hash-verified

134
135 @pass_alpharep
136 def test_open(self, alpharep):
137 root = zipfile.Path(alpharep)
138 a, n, b, g, j = root.iterdir()
139 with a.open(encoding="utf-8") as strm:
140 data = strm.read()
141 self.assertEqual(data, "content of a")
142 with a.open('r', "utf-8") as strm: # not a kw, no gh-101144 TypeError
143 data = strm.read()
144 self.assertEqual(data, "content of a")
145
146 def test_open_encoding_utf16(self):
147 in_memory_file = io.BytesIO()

Callers

nothing calls this directly

Calls 4

iterdirMethod · 0.95
openMethod · 0.45
readMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected