]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue 3801. Fixing a dumb error in the deprecated parse_qsl()
authorFacundo Batista <facundobatista@gmail.com>
Mon, 8 Sep 2008 00:20:28 +0000 (00:20 +0000)
committerFacundo Batista <facundobatista@gmail.com>
Mon, 8 Sep 2008 00:20:28 +0000 (00:20 +0000)
function.  Tests added.

Lib/cgi.py
Lib/test/test_cgi.py

index 373ba51fc1cc3c2010404410eeb156e1144f1add..33b91bfbd235847d4ef11a9f7875d898e31fa3cd 100755 (executable)
@@ -189,7 +189,7 @@ def parse_qsl(qs, keep_blank_values=0, strict_parsing=0):
     """Parse a query given as a string argument."""
     warn("cgi.parse_qsl is deprecated, use urlparse.parse_qsl instead",
             PendingDeprecationWarning)
-    return urlparse.parse_qs(qs, keep_blank_values, strict_parsing)
+    return urlparse.parse_qsl(qs, keep_blank_values, strict_parsing)
 
 def parse_multipart(fp, pdict):
     """Parse multipart input.
index 79bca4ee9a6e0f75bdceccfab14e4dbd2463c2d0..fa1d37fceb856969b777f5144b67d8b4d512ce41 100644 (file)
@@ -344,6 +344,17 @@ this is the content of the fake file
         v = gen_result(data, environ)
         self.assertEqual(result, v)
 
+    def test_deprecated_parse_qs(self):
+        # this func is moved to urlparse, this is just a sanity check
+        self.assertEqual({'a': ['A1'], 'B': ['B3'], 'b': ['B2']},
+                         cgi.parse_qs('a=A1&b=B2&B=B3'))
+
+    def test_deprecated_parse_qsl(self):
+        # this func is moved to urlparse, this is just a sanity check
+        self.assertEqual([('a', 'A1'), ('b', 'B2'), ('B', 'B3')],
+                         cgi.parse_qsl('a=A1&b=B2&B=B3'))
+
+
 def test_main():
     run_unittest(CgiTests)