def normalize_version(version: str) -> str: return PEP440Version.parse(version).to_string()
def test_pep440_parse_text_invalid_versions(text): with pytest.raises(InvalidVersion): assert PEP440Version.parse(text)
assert ReleaseTag(*parts).next_phase() == result @pytest.mark.parametrize( "phase", list({*RELEASE_PHASES.keys(), *RELEASE_PHASES_SHORT.keys()}) ) def test_pep440_release_tag_next(phase): tag = ReleaseTag(phase=phase).next() assert tag.phase == ReleaseTag.expand(phase) assert tag.number == 1 @pytest.mark.parametrize( "text,result", [ ("1", PEP440Version(release=Release.from_parts(1))), ("1.2.3", PEP440Version(release=Release.from_parts(1, 2, 3))), ( "1.2.3-1", PEP440Version( release=Release.from_parts(1, 2, 3), post=ReleaseTag("post", 1) ), ), ( "1.2.3.dev1", PEP440Version( release=Release.from_parts(1, 2, 3), dev=ReleaseTag("dev", 1) ), ), ( "1.2.3-1.dev1",
def test_pep440_parse_text(text, result): assert PEP440Version.parse(text) == result
def test_pep440_parse_text(text: str, result: PEP440Version) -> None: assert PEP440Version.parse(text) == result