diff options
author | Stéphane Bidoul <stephane.bidoul@gmail.com> | 2023-04-07 23:44:22 +0200 |
---|---|---|
committer | Stéphane Bidoul <stephane.bidoul@gmail.com> | 2023-04-07 23:44:22 +0200 |
commit | 48152bb2e147f11a350b9b7c90057b15b6ba70ea (patch) | |
tree | f41a166ee8c7850ac5000d2b3d0b1c37c212f16b /tests | |
parent | 6e5d4678220063f7d0feae82ff9cb970252beb76 (diff) | |
download | pip-48152bb2e147f11a350b9b7c90057b15b6ba70ea.tar.gz |
pep 658 hashes are not URL fragment hashes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/test_collector.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/unit/test_collector.py b/tests/unit/test_collector.py index 5f949d14d..bbb631cf8 100644 --- a/tests/unit/test_collector.py +++ b/tests/unit/test_collector.py @@ -1073,4 +1073,20 @@ def test_link_collector_create_find_links_expansion( ], ) def test_link_hash_parsing(url: str, result: Optional[LinkHash]) -> None: - assert LinkHash.split_hash_name_and_value(url) == result + assert LinkHash.find_hash_url_fragment(url) == result + + +@pytest.mark.parametrize( + "dist_info_metadata, result", + [ + ("sha256=aa113592bbe", LinkHash("sha256", "aa113592bbe")), + ("sha500=aa113592bbe", None), + ("true", None), + ("", None), + ("aa113592bbe", None), + ], +) +def test_pep658_hash_parsing( + dist_info_metadata: str, result: Optional[LinkHash] +) -> None: + assert LinkHash.parse_pep658_hash(dist_info_metadata) == result |