Closed bollwyvl closed 2 weeks ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 75.05%. Comparing base (
2c96e01
) to head (2bea2c2
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
add some tests? I know the tests are thing already. :/
how do we feel about moving a bunch of the black
-violating tests to .txt
-based fixtures?
What do you mean by that? W/e it is, a new PR please.
I honestly don't get how this PR passes or works. Here are the existing tests for url transforms w/ pypi (which is way more complete than I recall!):
def test_url_transform_pypi():
urls = set(list(gen_transformed_urls("https://pypi.io/{{ name }}/{{ name }}-barf")))
assert urls == {
"https://files.pythonhosted.org/{{ name }}/{{ name }}-barf",
"https://files.pythonhosted.org/{{ name }}/{{ name.replace('-', '_') }}-barf",
"https://files.pythonhosted.org/{{ name }}/{{ name.replace('_', '-') }}-barf",
"https://pypi.io/{{ name }}/{{ name }}-barf",
"https://pypi.io/{{ name }}/{{ name.replace('-', '_') }}-barf",
"https://pypi.io/{{ name }}/{{ name.replace('_', '-') }}-barf",
}
urls = set(
list(
gen_transformed_urls(
"https://pypi.io/{{ name }}/{{ name.replace('_', '-') }}-barf",
),
),
)
assert urls == {
"https://files.pythonhosted.org/{{ name }}/{{ name }}-barf",
"https://files.pythonhosted.org/{{ name }}/{{ name.replace('_', '-') }}-barf",
"https://pypi.io/{{ name }}/{{ name }}-barf",
"https://pypi.io/{{ name }}/{{ name.replace('_', '-') }}-barf",
}
urls = set(
list(
gen_transformed_urls(
"https://pypi.io/{{ name }}/{{ name.replace('_','-') }}-barf",
),
),
)
assert urls == {
"https://files.pythonhosted.org/{{ name }}/{{ name }}-barf",
"https://files.pythonhosted.org/{{ name }}/{{ name.replace('_','-') }}-barf",
"https://pypi.io/{{ name }}/{{ name }}-barf",
"https://pypi.io/{{ name }}/{{ name.replace('_','-') }}-barf",
}
urls = set(
list(
gen_transformed_urls(
"https://pypi.io/{{ name }}/{{ name|replace('_','-') }}-barf",
),
),
)
assert urls == {
"https://files.pythonhosted.org/{{ name }}/{{ name }}-barf",
"https://files.pythonhosted.org/{{ name }}/{{ name|replace('_','-') }}-barf",
"https://pypi.io/{{ name }}/{{ name }}-barf",
"https://pypi.io/{{ name }}/{{ name|replace('_','-') }}-barf",
}
urls = set(
list(
gen_transformed_urls(
'https://pypi.io/{{ name }}/{{ name.replace("_", "-") }}-barf',
),
),
)
assert urls == {
"https://files.pythonhosted.org/{{ name }}/{{ name }}-barf",
'https://files.pythonhosted.org/{{ name }}/{{ name.replace("_", "-") }}-barf',
"https://pypi.io/{{ name }}/{{ name }}-barf",
'https://pypi.io/{{ name }}/{{ name.replace("_", "-") }}-barf',
}
We already test at least part of the -
to _
transform, right?
Oh you are munging hard-coded names. duh. Needs tests then for sure.
fixtures
url transforms w/ pypi (which is way more complete than I recall!):
Made #2797. Might do a little work there before coming back to here... and indeed, this (draft) PR needs some better stress tests, especially of bad/special/magic cases that categorically did change over time (PEP420 with .
, poetry
and flit
epochs, etc. ).
We have pre-commit so it should be easy to solve linter errors.
pre-commit.ci autofix
I am struggling to find any in-the-wild examples that normalize .
to _
, or apply case normalization.
That's fine. As long as something made up is in the tests, it will be fine I think.
Thank you!
This adds yet another URL to try, namely the basically-now-ubiquitous PEP625 form: