summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2001-01-20 20:22:30 (GMT)
committerSkip Montanaro <skip@pobox.com>2001-01-20 20:22:30 (GMT)
commite78b92a062153ace94989e79d36e04e0997d1710 (patch)
tree2dbbac64e7da0d6fbe373063929793c770e2e3c1 /Lib/test
parente99d5ea25ba994491c773d9b5872332334ccd1c5 (diff)
downloadcpython-e78b92a062153ace94989e79d36e04e0997d1710.zip
cpython-e78b92a062153ace94989e79d36e04e0997d1710.tar.gz
cpython-e78b92a062153ace94989e79d36e04e0997d1710.tar.bz2
added some tests for urlencode
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_urllib.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 3ce1045..4d93289 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -34,3 +34,19 @@ out2_2 = "abc?def"
verify(urllib.quote(in2) == out2_1, "urllib.quote problem 4")
verify(urllib.quote(in2, '?') == out2_2, "urllib.quote problem 5")
+
+in3 = {"p1":"v1","p2":"v2"}
+exp3_1 = "p2=v2&p1=v1"
+exp3_2 = "p1=v1&p2=v2"
+act3 = urllib.urlencode(in3)
+verify(act3==exp3_1 or act3==exp3_2, "urllib.urlencode problem 1")
+
+in4 = {"p1":["v1","v2"]}
+exp4 = "p1=v1&p1=v2"
+act4 = urllib.urlencode(in4,doseq=1)
+verify(act4==exp4, "urllib.urlencode problem 2")
+
+in5 = in4
+exp5 = "p1=%5B%27v1%27%2C+%27v2%27%5D"
+act5 = urllib.urlencode(in5)
+verify(act5==exp5, "urllib.urlencode problem 3")