summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFacundo Batista <facundobatista@gmail.com>2008-09-09 02:43:19 (GMT)
committerFacundo Batista <facundobatista@gmail.com>2008-09-09 02:43:19 (GMT)
commita27244bfa13ed7e0efd0d0fd2dd6a553fbb08124 (patch)
tree3bc30bfbe80a939a298253cc4311076a4e101453
parent1cd0247a4d1b8282631707ba06b514aeddc75782 (diff)
downloadcpython-a27244bfa13ed7e0efd0d0fd2dd6a553fbb08124.zip
cpython-a27244bfa13ed7e0efd0d0fd2dd6a553fbb08124.tar.gz
cpython-a27244bfa13ed7e0efd0d0fd2dd6a553fbb08124.tar.bz2
Added a warning filter to don't show the warning during
the tests. Also fixed the warning message in cgi.py
-rwxr-xr-xLib/cgi.py2
-rw-r--r--Lib/test/test_cgi.py17
2 files changed, 14 insertions, 5 deletions
diff --git a/Lib/cgi.py b/Lib/cgi.py
index d1ac4be..e62fcf2 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -168,7 +168,7 @@ def parse_qs(qs, keep_blank_values=0, strict_parsing=0):
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 urllib.parse.parse_qs instead",
+ warn("cgi.parse_qsl is deprecated, use urllib.parse.parse_qsl instead",
DeprecationWarning)
return urllib.parse.parse_qsl(qs, keep_blank_values, strict_parsing)
diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py
index 9491001..0c53d8f 100644
--- a/Lib/test/test_cgi.py
+++ b/Lib/test/test_cgi.py
@@ -5,6 +5,7 @@ import sys
import tempfile
import unittest
from io import StringIO
+from warnings import catch_warnings, filterwarnings
class HackedSysModule:
# The regression test will have real values in sys.argv, which
@@ -308,13 +309,21 @@ this is the content of the fake file
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'))
+ with catch_warnings():
+ filterwarnings('ignore',
+ 'cgi.parse_qs is deprecated, use urllib.parse.parse_qs instead',
+ DeprecationWarning)
+ 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'))
+ with catch_warnings():
+ filterwarnings('ignore',
+ 'cgi.parse_qsl is deprecated, use urllib.parse.parse_qsl instead',
+ DeprecationWarning)
+ self.assertEqual([('a', 'A1'), ('b', 'B2'), ('B', 'B3')],
+ cgi.parse_qsl('a=A1&b=B2&B=B3'))
def test_main():
run_unittest(CgiTests)