summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-03-29 19:30:44 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-03-29 19:30:44 (GMT)
commit34f9277d5643908b324102edcfa84903f7aab3cd (patch)
tree79724b63047064be2086dc7e603509f400d26313 /Lib/test
parent6044655d59d33c7a5e5ca439b564ee753610b789 (diff)
downloadcpython-34f9277d5643908b324102edcfa84903f7aab3cd.zip
cpython-34f9277d5643908b324102edcfa84903f7aab3cd.tar.gz
cpython-34f9277d5643908b324102edcfa84903f7aab3cd.tar.bz2
Merged revisions 79047 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r79047 | senthil.kumaran | 2010-03-18 17:44:15 +0530 (Thu, 18 Mar 2010) | 3 lines Fix for Issue8135 - urllib.unquote to support mixed percent escapes ........
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_urllib.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index d05574c..402309c 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -440,6 +440,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