"subdirectory", "subdirectory", ), ), ], ) def test_normalize_url(url: str, normalized: GitUrl) -> None: assert normalized == Git.normalize_url(url) @pytest.mark.parametrize( "url, parsed", [ ( "git+ssh://user@hostname:project.git#commit", ParsedUrl("ssh", "hostname", ":project.git", "user", None, "project", "commit"), ), ( "git+http://user@hostname/project/blah.git@commit", ParsedUrl("http", "hostname", "/project/blah.git", "user", None, "blah", "commit"), ), ( "git+https://user@hostname/project/blah.git", ParsedUrl("https", "hostname", "/project/blah.git", "user", None, "blah", None), ), ( "git+https://user@hostname/project~_-.foo/blah~_-.bar.git", ParsedUrl( "https",
), ], ) def test_normalize_url(url, normalized): assert normalized == Git.normalize_url(url) @pytest.mark.parametrize( "url, parsed", [ ( "git+ssh://user@hostname:project.git#commit", ParsedUrl( protocol="ssh", resource="hostname", pathname=":project.git", user="******", name="project", rev="commit", ), ), ( "git+http://user@hostname/project/blah.git@commit", ParsedUrl( protocol="http", resource="hostname", pathname="/project/blah.git", user="******", name="blah", rev="commit", ), ),