File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2265,6 +2265,10 @@ def replace(
22652265 automatically encoded instead of an error being raised.
22662266 """
22672267 if path is not _UNSET :
2268+ if isinstance (path , Text ):
2269+ raise TypeError (
2270+ "expected iterable of text for path, not: %r" % (path ,)
2271+ )
22682272 path = tuple (_encode_reserved (p ) for p in path )
22692273 if query is not _UNSET :
22702274 query = cast (
Original file line number Diff line number Diff line change @@ -1023,6 +1023,18 @@ def test_technicallyTextIsIterableBut(self):
10231023 "expected iterable of text for path, not: {0}" .format (repr ("foo" )),
10241024 )
10251025
1026+ decoded_url = URL .from_text (
1027+ "https://example.com/api/v1/webui"
1028+ ).get_decoded_url ()
1029+ with self .assertRaises (TypeError ) as raised :
1030+ decoded_url .replace (path = "support/woo" )
1031+ self .assertEqual (
1032+ str (raised .exception ),
1033+ "expected iterable of text for path, not: {0}" .format (
1034+ repr ("support/woo" )
1035+ ),
1036+ )
1037+
10261038 def test_netloc (self ):
10271039 # type: () -> None
10281040 url = URL (scheme = "https" )
You can’t perform that action at this time.
0 commit comments