[Python-checkins] python/dist/src/Lib/test test_cgi.py,1.7,1.8

nascheme at users.sourceforge.net nascheme at users.sourceforge.net
Mon Jul 19 17:37:42 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19325/Lib/test

Modified Files:
	test_cgi.py 
Log Message:
Don't return spurious empty fields if 'keep_empty_values' is True.
Fixes SF bug #990307.


Index: test_cgi.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cgi.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** test_cgi.py	30 Jul 2002 23:26:01 -0000	1.7
--- test_cgi.py	19 Jul 2004 15:37:40 -0000	1.8
***************
*** 56,60 ****
  # a string with the query and a dictionary with the expected result.
  
! parse_test_cases = [
      ("", ValueError("bad query field: ''")),
      ("&", ValueError("bad query field: ''")),
--- 56,74 ----
  # a string with the query and a dictionary with the expected result.
  
! parse_qsl_test_cases = [
!     ("", []),
!     ("&", []),
!     ("&&", []),
!     ("=", [('', '')]),
!     ("=a", [('', 'a')]),
!     ("a", [('a', '')]),
!     ("a=", [('a', '')]),
!     ("a=", [('a', '')]),
!     ("&a=b", [('a', 'b')]),
!     ("a=a+b&b=b+c", [('a', 'a b'), ('b', 'b c')]),
!     ("a=1&a=2", [('a', '1'), ('a', '2')]),
! ]
! 
! parse_strict_test_cases = [
      ("", ValueError("bad query field: ''")),
      ("&", ValueError("bad query field: ''")),
***************
*** 115,119 ****
  
  def main():
!     for orig, expect in parse_test_cases:
          # Test basic parsing
          print repr(orig)
--- 129,138 ----
  
  def main():
!     for orig, expect in parse_qsl_test_cases:
!         result = cgi.parse_qsl(orig, keep_blank_values=True)
!         print repr(orig), '=>', result
!         verify(result == expect, "Error parsing %s" % repr(orig))
! 
!     for orig, expect in parse_strict_test_cases:
          # Test basic parsing
          print repr(orig)



More information about the Python-checkins mailing list