@@ -66,11 +66,6 @@ def test_str():
66
66
[
67
67
("http://example.com/path/to" , "http://example.com/" , "path/to" ),
68
68
("http://example.com/path/to" , "http://example.com/spam" , "path/to" ),
69
- (
70
- "http://example.com/////path/////to" ,
71
- "http://example.com/////spam" ,
72
- "path/to" ,
73
- ),
74
69
("http://example.com/this/is/a/test" , "http://example.com/this/" , "is/a/test" ),
75
70
(
76
71
"http://example.com/this/./is/a/test" ,
@@ -103,6 +98,28 @@ def test_sub(target: str, base: str, expected: str):
103
98
assert result_url == expected_url
104
99
105
100
101
+ @pytest .mark .xfail (reason = "Empty segments are not preserved" )
102
+ @pytest .mark .parametrize (
103
+ ("target" , "base" , "expected" ),
104
+ [
105
+ (
106
+ "http://example.com/////path/////to" ,
107
+ "http://example.com/////spam" ,
108
+ "path/////to" ,
109
+ ),
110
+ (
111
+ "http://example.com////path/////to" ,
112
+ "http://example.com/////spam" ,
113
+ "..//path/////to" ,
114
+ ),
115
+ ],
116
+ )
117
+ def test_sub_empty_segments (target : str , base : str , expected : str ):
118
+ expected_url = URL (expected )
119
+ result_url = URL (target ) - URL (base )
120
+ assert result_url == expected_url
121
+
122
+
106
123
def test_sub_with_different_schemes ():
107
124
expected_error_msg = "Both URLs should have the same scheme"
108
125
with pytest .raises (ValueError , match = expected_error_msg ):
0 commit comments