File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -1517,7 +1517,7 @@ class DecodedURL(object):
1517
1517
handled automatically.
1518
1518
1519
1519
Where applicable, a UTF-8 encoding is presumed. Be advised that
1520
- some interactions, can raise :exc:`UnicodeEncodeErrors` and
1520
+ some interactions can raise :exc:`UnicodeEncodeErrors` and
1521
1521
:exc:`UnicodeDecodeErrors`, just like when working with
1522
1522
bytestrings. Examples of such interactions include handling query
1523
1523
strings encoding binary data, and paths containing segments with
Original file line number Diff line number Diff line change @@ -60,8 +60,7 @@ def test_passthroughs(self):
60
60
durl2 = DecodedURL .from_text (TOTAL_URL , lazy = True )
61
61
assert durl2 == durl2 .encoded_url .get_decoded_url (lazy = True )
62
62
63
- # TODO change this to the actual value when str() changes get merged
64
- assert '%20' in str (DecodedURL .from_text (BASIC_URL ).child (' ' ))
63
+ assert str (DecodedURL .from_text (BASIC_URL ).child (' ' )) == 'http://example.com/%20'
65
64
66
65
assert not (durl == 1 )
67
66
assert durl != 1
@@ -89,10 +88,11 @@ def test_query_manipulation(self):
89
88
90
89
assert durl .set ('arg' , 'd' ).get ('arg' ) == ['d' ]
91
90
92
- def test_equivalences (self ):
91
+ def test_equality_and_hashability (self ):
93
92
durl = DecodedURL .from_text (TOTAL_URL )
94
93
durl2 = DecodedURL .from_text (TOTAL_URL )
95
94
burl = DecodedURL .from_text (BASIC_URL )
95
+ durl_uri = durl .to_uri ()
96
96
97
97
assert durl == durl
98
98
assert durl == durl2
@@ -106,6 +106,14 @@ def test_equivalences(self):
106
106
107
107
assert len (durl_map ) == 1
108
108
109
+ durl_map [burl ] = burl
110
+
111
+ assert len (durl_map ) == 2
112
+
113
+ durl_map [durl_uri ] = durl_uri
114
+
115
+ assert len (durl_map ) == 3
116
+
109
117
def test_replace_roundtrip (self ):
110
118
durl = DecodedURL .from_text (TOTAL_URL )
111
119
Original file line number Diff line number Diff line change 8
8
BASIC_URL = 'http://example.com/#'
9
9
TOTAL_URL = "https://%75%73%65%72:%00%00%00%[email protected] :8080/a/nice%20nice/./path/?zot=23%25&zut#frég"
10
10
UNDECODABLE_FRAG_URL = TOTAL_URL + '%C3'
11
+ # the %C3 above percent-decodes to an unpaired \xc3 byte which makes this
12
+ # invalid utf8
11
13
12
14
13
15
class TestURL (HyperlinkTestCase ):
You can’t perform that action at this time.
0 commit comments