(self)
| 1711 | os.remove(filename) |
| 1712 | |
| 1713 | def test_close(self): |
| 1714 | with io.BytesIO(COMPRESSED_100_PLUS_32KB) as src: |
| 1715 | f = ZstdFile(src) |
| 1716 | f.close() |
| 1717 | # ZstdFile.close() should not close the underlying file object. |
| 1718 | self.assertFalse(src.closed) |
| 1719 | # Try closing an already-closed ZstdFile. |
| 1720 | f.close() |
| 1721 | self.assertFalse(src.closed) |
| 1722 | |
| 1723 | # Test with a real file on disk, opened directly by ZstdFile. |
| 1724 | with tempfile.NamedTemporaryFile(delete=False) as tmp_f: |
| 1725 | filename = pathlib.Path(tmp_f.name) |
| 1726 | |
| 1727 | f = ZstdFile(filename) |
| 1728 | fp = f._fp |
| 1729 | f.close() |
| 1730 | # Here, ZstdFile.close() *should* close the underlying file object. |
| 1731 | self.assertTrue(fp.closed) |
| 1732 | # Try closing an already-closed ZstdFile. |
| 1733 | f.close() |
| 1734 | |
| 1735 | os.remove(filename) |
| 1736 | |
| 1737 | def test_closed(self): |
| 1738 | f = ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB)) |
nothing calls this directly
no test coverage detected