mirror of
https://github.com/python/cpython.git
synced 2025-11-20 02:50:14 +00:00
Fix for Issue8135 - urllib.unquote to support mixed percent escapes
This commit is contained in:
parent
43fe03a206
commit
f3e9b2a996
3 changed files with 31 additions and 4 deletions
|
|
@ -439,6 +439,32 @@ class UnquotingTests(unittest.TestCase):
|
|||
"using unquote(): not all characters escaped: "
|
||||
"%s" % result)
|
||||
|
||||
def test_unquoting_badpercent(self):
|
||||
# Test unquoting on bad percent-escapes
|
||||
given = '%xab'
|
||||
expect = given
|
||||
result = urllib.unquote(given)
|
||||
self.assertEqual(expect, result, "using unquote(): %r != %r"
|
||||
% (expect, result))
|
||||
given = '%x'
|
||||
expect = given
|
||||
result = urllib.unquote(given)
|
||||
self.assertEqual(expect, result, "using unquote(): %r != %r"
|
||||
% (expect, result))
|
||||
given = '%'
|
||||
expect = given
|
||||
result = urllib.unquote(given)
|
||||
self.assertEqual(expect, result, "using unquote(): %r != %r"
|
||||
% (expect, result))
|
||||
|
||||
def test_unquoting_mixed_case(self):
|
||||
# Test unquoting on mixed-case hex digits in the percent-escapes
|
||||
given = '%Ab%eA'
|
||||
expect = '\xab\xea'
|
||||
result = urllib.unquote(given)
|
||||
self.assertEqual(expect, result, "using unquote(): %r != %r"
|
||||
% (expect, result))
|
||||
|
||||
def test_unquoting_parts(self):
|
||||
# Make sure unquoting works when have non-quoted characters
|
||||
# interspersed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue