mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Cleanup some test cases using check_warnings and check_py3k_warnings.
This commit is contained in:
parent
2b73c21bed
commit
945a8ba635
6 changed files with 53 additions and 79 deletions
|
|
@ -115,7 +115,7 @@ def gen_result(data, environ):
|
|||
|
||||
result = {}
|
||||
for k, v in dict(form).items():
|
||||
result[k] = type(v) is list and form.getlist(k) or v.value
|
||||
result[k] = isinstance(v, list) and form.getlist(k) or v.value
|
||||
|
||||
return result
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ class CgiTests(unittest.TestCase):
|
|||
fcd = cgi.FormContentDict(env)
|
||||
sd = cgi.SvFormContentDict(env)
|
||||
fs = cgi.FieldStorage(environ=env)
|
||||
if type(expect) == type({}):
|
||||
if isinstance(expect, dict):
|
||||
# test dict interface
|
||||
self.assertEqual(len(expect), len(fcd))
|
||||
self.assertSameElements(expect.keys(), fcd.keys())
|
||||
|
|
@ -340,13 +340,13 @@ this is the content of the fake file
|
|||
self.assertEqual(result, v)
|
||||
|
||||
def test_deprecated_parse_qs(self):
|
||||
with check_warnings():
|
||||
with check_warnings(quiet=False):
|
||||
# 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):
|
||||
with check_warnings():
|
||||
with check_warnings(quiet=False):
|
||||
# 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'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue