https://github.com/python/cpython/commit/6658ada1ea2d32d19038924f8f88868ecf18d161 commit: 6658ada1ea2d32d19038924f8f88868ecf18d161 branch: 3.12 author: sobolevn <m...@sobolevn.me> committer: sobolevn <m...@sobolevn.me> date: 2025-03-14T11:54:37Z summary:
[3.12] gh-131219: Improve tests in `test_lzma.py` by adding more asserts (GH-131220) (#131237) Co-authored-by: sobolevn <m...@sobolevn.me> files: M Lib/test/test_lzma.py diff --git a/Lib/test/test_lzma.py b/Lib/test/test_lzma.py index db290e139327e0..14029c17539b85 100644 --- a/Lib/test/test_lzma.py +++ b/Lib/test/test_lzma.py @@ -538,13 +538,13 @@ class FileTestCase(unittest.TestCase): def test_init(self): with LZMAFile(BytesIO(COMPRESSED_XZ)) as f: - pass + self.assertIsInstance(f, LZMAFile) with LZMAFile(BytesIO(), "w") as f: - pass + self.assertIsInstance(f, LZMAFile) with LZMAFile(BytesIO(), "x") as f: - pass + self.assertIsInstance(f, LZMAFile) with LZMAFile(BytesIO(), "a") as f: - pass + self.assertIsInstance(f, LZMAFile) def test_init_with_PathLike_filename(self): filename = FakePath(TESTFN) @@ -567,25 +567,25 @@ def test_init_with_filename(self): def test_init_mode(self): with TempFile(TESTFN): - with LZMAFile(TESTFN, "r"): - pass - with LZMAFile(TESTFN, "rb"): - pass - with LZMAFile(TESTFN, "w"): - pass - with LZMAFile(TESTFN, "wb"): - pass - with LZMAFile(TESTFN, "a"): - pass - with LZMAFile(TESTFN, "ab"): - pass + with LZMAFile(TESTFN, "r") as f: + self.assertIsInstance(f, LZMAFile) + with LZMAFile(TESTFN, "rb") as f: + self.assertIsInstance(f, LZMAFile) + with LZMAFile(TESTFN, "w") as f: + self.assertIsInstance(f, LZMAFile) + with LZMAFile(TESTFN, "wb") as f: + self.assertIsInstance(f, LZMAFile) + with LZMAFile(TESTFN, "a") as f: + self.assertIsInstance(f, LZMAFile) + with LZMAFile(TESTFN, "ab") as f: + self.assertIsInstance(f, LZMAFile) def test_init_with_x_mode(self): self.addCleanup(unlink, TESTFN) for mode in ("x", "xb"): unlink(TESTFN) with LZMAFile(TESTFN, mode) as f: - pass + self.assertIsInstance(f, LZMAFile) with self.assertRaises(FileExistsError): LZMAFile(TESTFN, mode) _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com