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

Method test_empty_zipfile

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

Source from the content-addressed store, hash-verified

2251 self.assertEqual(zipf.comment, b"this is a comment")
2252
2253 def test_empty_zipfile(self):
2254 # Check that creating a file in 'w' or 'a' mode and closing without
2255 # adding any files to the archives creates a valid empty ZIP file
2256 zipf = zipfile.ZipFile(TESTFN, mode="w")
2257 zipf.close()
2258 try:
2259 zipf = zipfile.ZipFile(TESTFN, mode="r")
2260 except zipfile.BadZipFile:
2261 self.fail("Unable to create empty ZIP file in 'w' mode")
2262 zipf.close()
2263
2264 zipf = zipfile.ZipFile(TESTFN, mode="a")
2265 zipf.close()
2266 try:
2267 zipf = zipfile.ZipFile(TESTFN, mode="r")
2268 except:
2269 self.fail("Unable to create empty ZIP file in 'a' mode")
2270 zipf.close()
2271
2272 def test_open_empty_file(self):
2273 # Issue 1710703: Check that opening a file with less than 22 bytes

Callers

nothing calls this directly

Calls 2

closeMethod · 0.95
failMethod · 0.45

Tested by

no test coverage detected