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

Method test_write_pathlike

Lib/test/test_zipfile/test_core.py:1616–1627  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1614 rmtree(TESTFN2)
1615
1616 def test_write_pathlike(self):
1617 os.mkdir(TESTFN2)
1618 try:
1619 with open(os.path.join(TESTFN2, "mod1.py"), "w", encoding='utf-8') as fp:
1620 fp.write("print(42)\n")
1621
1622 with TemporaryFile() as t, zipfile.PyZipFile(t, "w") as zipfp:
1623 zipfp.writepy(FakePath(os.path.join(TESTFN2, "mod1.py")))
1624 names = zipfp.namelist()
1625 self.assertCompiledIn('mod1.py', names)
1626 finally:
1627 rmtree(TESTFN2)
1628
1629
1630class ExtractTests(unittest.TestCase):

Callers

nothing calls this directly

Calls 10

assertCompiledInMethod · 0.95
TemporaryFileFunction · 0.90
FakePathClass · 0.90
rmtreeFunction · 0.90
writepyMethod · 0.80
openFunction · 0.50
mkdirMethod · 0.45
joinMethod · 0.45
writeMethod · 0.45
namelistMethod · 0.45

Tested by

no test coverage detected