-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests and a changenote for corrupted metadata fix
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from wheelfile import WheelFile | ||
|
||
|
||
def test_when_metadata_is_corrupted_sets_metadata_to_none(buf): | ||
wf = WheelFile(buf, distname="_", version="0", mode="w") | ||
wf.metadata = "This is not a valid metadata" # type: ignore | ||
wf.close() | ||
|
||
with WheelFile(buf, distname="_", version="0", mode="rl") as broken_wf: | ||
assert broken_wf.metadata is None | ||
|
||
|
||
def test_when_wheeldata_is_corrupted_sets_wheeldata_to_none(buf): | ||
wf = WheelFile(buf, distname="_", version="0", mode="w") | ||
wf.wheeldata = "This is not a valid wheeldata" # type: ignore | ||
wf.close() | ||
|
||
with WheelFile(buf, distname="_", version="0", mode="rl") as broken_wf: | ||
assert broken_wf.wheeldata is None | ||
|
||
|
||
def test_wheeldata_is_read_even_if_metadata_corrupted(buf): | ||
wf = WheelFile(buf, distname="_", version="0", mode="w") | ||
wf.metadata = "This is not a valid metadata" # type: ignore | ||
wf.close() | ||
|
||
with WheelFile(buf, distname="_", version="0", mode="rl") as broken_wf: | ||
assert broken_wf.wheeldata is not None | ||
|
||
|
||
def test_metadata_is_read_even_if_wheeldata_corrupted(buf): | ||
wf = WheelFile(buf, distname="_", version="0", mode="w") | ||
wf.wheeldata = "This is not a valid wheeldata" # type: ignore | ||
wf.close() | ||
|
||
with WheelFile(buf, distname="_", version="0", mode="rl") as broken_wf: | ||
assert broken_wf.metadata is not None |