self.assertEqual(result.count('%'), 1,
"using unquote(): not all characters escaped: "
"%s" % result)
+ self.assertRaises(TypeError, urllib.parse.unquote, None)
def test_unquoting_badpercent(self):
# Test unquoting on bad percent-escapes
self.assertEqual(expect, result, "using unquote_to_bytes(): %r != %r"
% (expect, result))
+ self.assertRaises(TypeError, urllib.parse.unquote_to_bytes, None)
+
def test_unquoting_mixed_case(self):
# Test unquoting on mixed-case hex digits in the percent-escapes
given = '%Ab%eA'
# Note: strings are encoded as UTF-8. This is only an issue if it contains
# unescaped non-ASCII characters, which URIs should not.
if not string:
+ if string is None:
+ raise TypeError('None object is invalid for unquote_to_bytes()')
return b''
if isinstance(string, str):
string = string.encode('utf-8')
unquote('abc%20def') -> 'abc def'.
"""
if not string:
+ if string is None:
+ raise TypeError('None object is invalid for unquote() function.')
return string
res = string.split('%')
if len(res) == 1: