| 2322 | self.assertEqual(zipf.comment, b"this is a comment") |
| 2323 | |
| 2324 | def test_empty_zipfile(self): |
| 2325 | # Check that creating a file in 'w' or 'a' mode and closing without |
| 2326 | # adding any files to the archives creates a valid empty ZIP file |
| 2327 | zipf = zipfile.ZipFile(TESTFN, mode="w") |
| 2328 | zipf.close() |
| 2329 | try: |
| 2330 | zipf = zipfile.ZipFile(TESTFN, mode="r") |
| 2331 | except zipfile.BadZipFile: |
| 2332 | self.fail("Unable to create empty ZIP file in 'w' mode") |
| 2333 | zipf.close() |
| 2334 | |
| 2335 | zipf = zipfile.ZipFile(TESTFN, mode="a") |
| 2336 | zipf.close() |
| 2337 | try: |
| 2338 | zipf = zipfile.ZipFile(TESTFN, mode="r") |
| 2339 | except: |
| 2340 | self.fail("Unable to create empty ZIP file in 'a' mode") |
| 2341 | zipf.close() |
| 2342 | |
| 2343 | def test_open_empty_file(self): |
| 2344 | # Issue 1710703: Check that opening a file with less than 22 bytes |