[Python-checkins] CVS: python/dist/src/Lib/test test_cgi.py,1.1,1.2
Moshe Zadka
python-dev@python.org
Fri, 25 Aug 2000 14:47:58 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv8221/Lib/test
Modified Files:
test_cgi.py
Log Message:
Closing patch #101120 -- After everyone agreed.
Index: test_cgi.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cgi.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** test_cgi.py 2000/08/03 22:11:42 1.1
--- test_cgi.py 2000/08/25 21:47:56 1.2
***************
*** 117,123 ****
assert d == expect, "Error parsing %s" % repr(orig)
! d = {'QUERY_STRING': orig}
! fcd = cgi.FormContentDict(d)
! sd = cgi.SvFormContentDict(d)
if type(expect) == type({}):
# test dict interface
--- 117,124 ----
assert d == expect, "Error parsing %s" % repr(orig)
! env = {'QUERY_STRING': orig}
! fcd = cgi.FormContentDict(env)
! sd = cgi.SvFormContentDict(env)
! fs = cgi.FieldStorage(environ=env)
if type(expect) == type({}):
# test dict interface
***************
*** 126,133 ****
--- 127,141 ----
assert norm(expect.values()) == norm(fcd.values())
assert norm(expect.items()) == norm(fcd.items())
+ assert fcd.get("nonexistent field", "default") == "default"
+ assert len(sd) == len(fs)
+ assert norm(sd.keys()) == norm(fs.keys())
+ assert fs.getvalue("nonexistent field", "default") == "default"
+ # test individual fields
for key in expect.keys():
expect_val = expect[key]
assert fcd.has_key(key)
assert norm(fcd[key]) == norm(expect[key])
+ assert fcd.get(key, "default") == fcd[key]
+ assert fs.has_key(key)
if len(expect_val) > 1:
single_value = 0
***************
*** 138,144 ****
--- 146,154 ----
except IndexError:
assert not single_value
+ assert fs.getvalue(key) == expect_val
else:
assert single_value
assert val == expect_val[0]
+ assert fs.getvalue(key) == expect_val[0]
assert norm(sd.getlist(key)) == norm(expect_val)
if single_value: