| 376 | pass |
| 377 | |
| 378 | def test_repr(self): |
| 379 | fname = 'file.name' |
| 380 | for f in get_files(self): |
| 381 | with zipfile.ZipFile(f, 'w', self.compression) as zipfp: |
| 382 | zipfp.write(TESTFN, fname) |
| 383 | r = repr(zipfp) |
| 384 | self.assertIn("mode='w'", r) |
| 385 | |
| 386 | with zipfile.ZipFile(f, 'r') as zipfp: |
| 387 | r = repr(zipfp) |
| 388 | if isinstance(f, str): |
| 389 | self.assertIn('filename=%r' % f, r) |
| 390 | else: |
| 391 | self.assertIn('file=%r' % f, r) |
| 392 | self.assertIn("mode='r'", r) |
| 393 | r = repr(zipfp.getinfo(fname)) |
| 394 | self.assertIn('filename=%r' % fname, r) |
| 395 | self.assertIn('filemode=', r) |
| 396 | self.assertIn('file_size=', r) |
| 397 | if self.compression != zipfile.ZIP_STORED: |
| 398 | self.assertIn('compress_type=', r) |
| 399 | self.assertIn('compress_size=', r) |
| 400 | with zipfp.open(fname) as zipopen: |
| 401 | r = repr(zipopen) |
| 402 | self.assertIn('name=%r' % fname, r) |
| 403 | if self.compression != zipfile.ZIP_STORED: |
| 404 | self.assertIn('compress_type=', r) |
| 405 | self.assertIn('[closed]', repr(zipopen)) |
| 406 | self.assertIn('[closed]', repr(zipfp)) |
| 407 | |
| 408 | def test_compresslevel_basic(self): |
| 409 | for f in get_files(self): |