Repository navigation
FileTestCase in test_lzma can be improved #131219
Copy link
Copy link
Closed
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
There are several tests that do not assert anything:
Lines 539 to 547 in 9649278
| def test_init(self): | |
| with LZMAFile(BytesIO(COMPRESSED_XZ)) as f: | |
| pass | |
| with LZMAFile(BytesIO(), "w") as f: | |
| pass | |
| with LZMAFile(BytesIO(), "x") as f: | |
| pass | |
| with LZMAFile(BytesIO(), "a") as f: | |
| pass |
Lines 574 to 594 in 9649278
| 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 | |
| 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 |
I propose to assert the context manager type and the mode.
I have a PR ready.
Linked PRs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
pythongh-131219: Improve tests in `test_lzma.py` by adding more asserts
gh-131219: Improve tests in `test_lzma.py` by adding more asserts (#1…
pythongh-131219: Improve tests in `test_lzma.py` by adding more asser…
[3.13] gh-131219: Improve tests in `test_lzma.py` by adding more asse…
[3.12] pythongh-131219: Improve tests in `test_lzma.py` by adding mor…
[3.12] gh-131219: Improve tests in `test_lzma.py` by adding more asse…
[3.12] pythongh-131219: Improve tests in `test_lzma.py` by adding mor…
pythongh-131219: Improve tests in `test_lzma.py` by adding more asser…