Skip to content

Commit f0b8db7

Browse files
authored
Add more URL subtraction coverage (#1389)
1 parent 7a272d2 commit f0b8db7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/test_url.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,27 @@ def test_str():
8080
("http://example.com/this/is/../a//test", "http://example.com/this/", "a/test"),
8181
("http://example.com/path/to", "http://example.com/spam/", "../path/to"),
8282
("http://example.com/path", "http://example.com/path/to/", ".."),
83+
("http://example.com/path", "http://example.com/other/../path/to/", ".."),
8384
("http://example.com/", "http://example.com/", "."),
8485
("http://example.com", "http://example.com", "."),
8586
("http://example.com/", "http://example.com", "."),
8687
("http://example.com", "http://example.com/", "."),
8788
("//example.com", "//example.com", "."),
8889
("/path/to", "/spam/", "../path/to"),
8990
("path/to", "spam/", "../path/to"),
91+
("path/../to", "path/", "../to"),
92+
("path/..", ".", "path/.."),
93+
("path/../replace/me", "path/../replace", "replace/me"),
94+
("path/../replace/me", "path/../replace/", "me"),
9095
("path/to", "spam", "path/to"),
9196
("..", ".", ".."),
9297
(".", "..", "."),
9398
],
9499
)
95100
def test_sub(target: str, base: str, expected: str):
96-
assert URL(target) - URL(base) == URL(expected)
101+
expected_url = URL(expected)
102+
result_url = URL(target) - URL(base)
103+
assert result_url == expected_url
97104

98105

99106
def test_sub_with_different_schemes():

0 commit comments

Comments
 (0)