@@ -18,19 +18,11 @@ def file_checksum() -> str:
18
18
return make_checksum ()
19
19
20
20
21
- @pytest .fixture ()
22
- def metadata_checksum () -> str :
23
- return make_checksum ()
24
-
25
-
26
- def make_url (
27
- ext : str , file_checksum : str | None = None , metadata_checksum : str | None = None
28
- ) -> Link :
21
+ def make_url (ext : str , file_checksum : str | None = None ) -> Link :
29
22
file_checksum = file_checksum or make_checksum ()
30
23
return Link (
31
24
"https://files.pythonhosted.org/packages/16/52/dead/"
32
25
f"demo-1.0.0.{ ext } #sha256={ file_checksum } " ,
33
- metadata = f"sha256={ metadata_checksum } " if metadata_checksum else None ,
34
26
)
35
27
36
28
@@ -40,12 +32,6 @@ def test_package_link_hash(file_checksum: str) -> None:
40
32
assert link .hash == file_checksum
41
33
assert link .show_url == "demo-1.0.0.whl"
42
34
43
- # this is legacy PEP 503, no metadata hash is present
44
- assert not link .has_metadata
45
- assert not link .metadata_url
46
- assert not link .metadata_hash
47
- assert not link .metadata_hash_name
48
-
49
35
50
36
@pytest .mark .parametrize (
51
37
("ext" , "check" ),
@@ -60,61 +46,3 @@ def test_package_link_hash(file_checksum: str) -> None:
60
46
def test_package_link_is_checks (ext : str , check : str ) -> None :
61
47
link = make_url (ext = ext )
62
48
assert getattr (link , f"is_{ check } " )
63
-
64
-
65
- @pytest .mark .parametrize (
66
- ("ext" , "has_metadata" ),
67
- [("whl" , True ), ("egg" , False ), ("tar.gz" , True ), ("zip" , True )],
68
- )
69
- def test_package_link_pep658 (
70
- ext : str , has_metadata : bool , metadata_checksum : str
71
- ) -> None :
72
- link = make_url (ext = ext , metadata_checksum = metadata_checksum )
73
-
74
- if has_metadata :
75
- assert link .has_metadata
76
- assert link .metadata_url == f"{ link .url_without_fragment } .metadata"
77
- assert link .metadata_hash == metadata_checksum
78
- assert link .metadata_hash_name == "sha256"
79
- else :
80
- assert not link .has_metadata
81
- assert not link .metadata_url
82
- assert not link .metadata_hash
83
- assert not link .metadata_hash_name
84
-
85
-
86
- def test_package_link_pep658_no_default_metadata () -> None :
87
- link = make_url (ext = "whl" )
88
-
89
- assert not link .has_metadata
90
- assert not link .metadata_url
91
- assert not link .metadata_hash
92
- assert not link .metadata_hash_name
93
-
94
-
95
- @pytest .mark .parametrize (
96
- ("metadata" , "has_metadata" ),
97
- [
98
- ("true" , True ),
99
- ("false" , False ),
100
- ("" , False ),
101
- ],
102
- )
103
- def test_package_link_pep653_non_hash_metadata_value (
104
- file_checksum : str , metadata : str | bool , has_metadata : bool
105
- ) -> None :
106
- link = Link (
107
- "https://files.pythonhosted.org/packages/16/52/dead/"
108
- f"demo-1.0.0.whl#sha256={ file_checksum } " ,
109
- metadata = metadata ,
110
- )
111
-
112
- if has_metadata :
113
- assert link .has_metadata
114
- assert link .metadata_url == f"{ link .url_without_fragment } .metadata"
115
- else :
116
- assert not link .has_metadata
117
- assert not link .metadata_url
118
-
119
- assert not link .metadata_hash
120
- assert not link .metadata_hash_name
0 commit comments