@@ -2183,6 +2183,7 @@ def test_parsing_populates_cache():
2183
2183
assert url ._cache ["raw_query_string" ] == "a=b"
2184
2184
assert url ._cache ["raw_fragment" ] == "frag"
2185
2185
assert url ._cache ["scheme" ] == "http"
2186
+ assert url ._cache ["raw_path" ] == "/path"
2186
2187
assert url .raw_user == "user"
2187
2188
assert url .raw_password == "password"
2188
2189
assert url .raw_host == "example.com"
@@ -2198,13 +2199,34 @@ def test_parsing_populates_cache():
2198
2199
assert url .raw_query_string == "a=b"
2199
2200
assert url .raw_fragment == "frag"
2200
2201
assert url .scheme == "http"
2202
+ assert url .raw_path == "/path"
2201
2203
assert url ._cache ["raw_user" ] == "user"
2202
2204
assert url ._cache ["raw_password" ] == "password"
2203
2205
assert url ._cache ["raw_host" ] == "example.com"
2204
2206
assert url ._cache ["explicit_port" ] == 80
2205
2207
assert url ._cache ["raw_query_string" ] == "a=b"
2206
2208
assert url ._cache ["raw_fragment" ] == "frag"
2207
2209
assert url ._cache ["scheme" ] == "http"
2210
+ assert url ._cache ["raw_path" ] == "/path"
2211
+
2212
+
2213
+ def test_relative_url_populates_cache ():
2214
+ """Test that parsing a relative URL populates the cache."""
2215
+ url = URL ("." )
2216
+ assert url ._cache ["raw_query_string" ] == ""
2217
+ assert url ._cache ["raw_fragment" ] == ""
2218
+ assert url ._cache ["scheme" ] == ""
2219
+ assert url ._cache ["raw_path" ] == "."
2220
+
2221
+
2222
+ def test_parsing_populates_cache_for_single_dot ():
2223
+ """Test that parsing a URL populates the cache for a single dot path."""
2224
+ url = URL ("http://example.com/." )
2225
+ # raw_path should be normalized to "/"
2226
+ assert url ._cache ["raw_path" ] == "/"
2227
+ assert url ._cache ["raw_host" ] == "example.com"
2228
+ assert url ._cache ["scheme" ] == "http"
2229
+ assert url .raw_path == "/"
2208
2230
2209
2231
2210
2232
@pytest .mark .parametrize (
0 commit comments