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

Method test_mutability

Lib/test/test_zipfile/_path/test_path.py:303–315  ·  view source on GitHub ↗

If the underlying zipfile is changed, the Path object should reflect that change.

(self, alpharep)

Source from the content-addressed store, hash-verified

301
302 @pass_alpharep
303 def test_mutability(self, alpharep):
304 """
305 If the underlying zipfile is changed, the Path object should
306 reflect that change.
307 """
308 root = zipfile.Path(alpharep)
309 a, n, b, g, j = root.iterdir()
310 alpharep.writestr('foo.txt', 'foo')
311 alpharep.writestr('bar/baz.txt', 'baz')
312 assert any(child.name == 'foo.txt' for child in root.iterdir())
313 assert (root / 'foo.txt').read_text(encoding="utf-8") == 'foo'
314 (baz,) = (root / 'bar').iterdir()
315 assert baz.read_text(encoding="utf-8") == 'baz'
316
317 HUGE_ZIPFILE_NUM_ENTRIES = 2**13
318

Callers

nothing calls this directly

Calls 5

iterdirMethod · 0.95
writestrMethod · 0.80
anyFunction · 0.50
read_textMethod · 0.45
iterdirMethod · 0.45

Tested by

no test coverage detected