Skip to content

Commit

Permalink
Add more URL subtraction coverage (#1389)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Oct 25, 2024
1 parent 7a272d2 commit f0b8db7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/test_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,27 @@ def test_str():
("http://example.com/this/is/../a//test", "http://example.com/this/", "a/test"),
("http://example.com/path/to", "http://example.com/spam/", "../path/to"),
("http://example.com/path", "http://example.com/path/to/", ".."),
("http://example.com/path", "http://example.com/other/../path/to/", ".."),
("http://example.com/", "http://example.com/", "."),
("http://example.com", "http://example.com", "."),
("http://example.com/", "http://example.com", "."),
("http://example.com", "http://example.com/", "."),
("//example.com", "//example.com", "."),
("/path/to", "/spam/", "../path/to"),
("path/to", "spam/", "../path/to"),
("path/../to", "path/", "../to"),
("path/..", ".", "path/.."),
("path/../replace/me", "path/../replace", "replace/me"),
("path/../replace/me", "path/../replace/", "me"),
("path/to", "spam", "path/to"),
("..", ".", ".."),
(".", "..", "."),
],
)
def test_sub(target: str, base: str, expected: str):
assert URL(target) - URL(base) == URL(expected)
expected_url = URL(expected)
result_url = URL(target) - URL(base)
assert result_url == expected_url


def test_sub_with_different_schemes():
Expand Down

0 comments on commit f0b8db7

Please sign in to comment.