summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2000-09-14 16:59:07 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2000-09-14 16:59:07 (GMT)
commit7ae51bf82d836f036376671c58882b058acd3e2e (patch)
tree902b2ca8ce3b9daa3e277e23476e9c56946b7be6 /Lib/test/test_urllib.py
parentd94f70716ec4714dac1f96a153900ac7234d38ef (diff)
downloadcpython-7ae51bf82d836f036376671c58882b058acd3e2e.zip
cpython-7ae51bf82d836f036376671c58882b058acd3e2e.tar.gz
cpython-7ae51bf82d836f036376671c58882b058acd3e2e.tar.bz2
Remove "," from the list of always_safe characters. It is a reserved
character according to RFC 2396. Add some text to quote doc string that explains the quoting rules better. This closes SF Bug #114427. Add _fast_quote operation that uses a dictionary instead of a list when the standard set of safe characters is used.
Diffstat (limited to 'Lib/test/test_urllib.py')
-rw-r--r--Lib/test/test_urllib.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 245efb3..484acea 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -12,3 +12,21 @@ expected = 'abcdefghijklmnopqrstuvwxyz%df%e0%e1%e2%e3%e4%e5%e6%e7%e8%e9%ea%eb%ec
test = urllib.quote(chars)
assert test == expected, "urllib.quote problem"
+test2 = urllib.unquote(expected)
+assert test2 == chars
+
+in1 = "abc/def"
+out1_1 = "abc/def"
+out1_2 = "abc%2fdef"
+
+assert urllib.quote(in1) == out1_1, "urllib.quote problem"
+assert urllib.quote(in1, '') == out1_2, "urllib.quote problem"
+
+in2 = "abc?def"
+out2_1 = "abc%3fdef"
+out2_2 = "abc?def"
+
+assert urllib.quote(in2) == out2_1, "urllib.quote problem"
+assert urllib.quote(in2, '?') == out2_2, "urllib.quote problem"
+
+