Skip to content

Commit eafd33a

Browse files
committed
Change tests
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent d563792 commit eafd33a

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

src/packageurl/contrib/purl2url.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def get_download_url(purl):
7878

7979
# Fallback on the `download_url` qualifier when available.
8080
purl_data = PackageURL.from_string(purl)
81-
return purl_data.qualifiers.get("download_url", None)
81+
if purl_data.qualifiers:
82+
return purl_data.qualifiers.get("download_url", None)
8283

8384

8485
def get_inferred_urls(purl):

tests/test_purl_spec.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ def load_spec_files(spec_dir):
116116
for case in cases:
117117
flattened_cases.append((filename, case["description"], case))
118118

119-
def test_cran():
120-
p = PackageURL(** {'name': 'URI::PackageURL', 'type':
121-
'cran', 'namespace': None, 'qualifiers': None, 'subpath': None})
122-
p.to_string()
123119

124120

125121
@pytest.mark.parametrize("filename,description,test_case", flattened_cases)
@@ -147,7 +143,7 @@ def run_test_case(case, test_type, desc):
147143

148144
elif test_type == "roundtrip":
149145
purl = PackageURL.from_string(case["input"])
150-
assert purl == PackageURL.from_string(case["expected_output"])
146+
assert purl.to_string() == case["expected_output"]
151147

152148
elif test_type == "build":
153149
input_data = case["input"]
@@ -159,4 +155,4 @@ def run_test_case(case, test_type, desc):
159155
qualifiers=input_data.get("qualifiers"),
160156
subpath=input_data.get("subpath"),
161157
)
162-
assert purl == PackageURL.from_string(case["expected_output"])
158+
assert purl.to_string() == case["expected_output"]

0 commit comments

Comments
 (0)