(self)
| 692 | preset=6, filters=FILTERS_RAW_1) |
| 693 | |
| 694 | def test_close(self): |
| 695 | with BytesIO(COMPRESSED_XZ) as src: |
| 696 | f = LZMAFile(src) |
| 697 | f.close() |
| 698 | # LZMAFile.close() should not close the underlying file object. |
| 699 | self.assertFalse(src.closed) |
| 700 | # Try closing an already-closed LZMAFile. |
| 701 | f.close() |
| 702 | self.assertFalse(src.closed) |
| 703 | |
| 704 | # Test with a real file on disk, opened directly by LZMAFile. |
| 705 | with TempFile(TESTFN, COMPRESSED_XZ): |
| 706 | f = LZMAFile(TESTFN) |
| 707 | fp = f._fp |
| 708 | f.close() |
| 709 | # Here, LZMAFile.close() *should* close the underlying file object. |
| 710 | self.assertTrue(fp.closed) |
| 711 | # Try closing an already-closed LZMAFile. |
| 712 | f.close() |
| 713 | |
| 714 | def test_closed(self): |
| 715 | f = LZMAFile(BytesIO(COMPRESSED_XZ)) |
nothing calls this directly
no test coverage detected