[Python-checkins] CVS: python/dist/src/Lib/test test_cfgparser.py,1.8,1.9

Fred L. Drake fdrake@users.sourceforge.net
Mon, 08 Oct 2001 10:13:14 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv15375

Modified Files:
	test_cfgparser.py 
Log Message:
Added tests that check getboolean() with the newly allowed values from
SF patch #467580.


Index: test_cfgparser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cfgparser.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** test_cfgparser.py	2001/07/06 17:22:48	1.8
--- test_cfgparser.py	2001/10/08 17:13:11	1.9
***************
*** 79,82 ****
--- 79,101 ----
  
  
+ def boolean(src):
+     print "Testing interpretation of boolean Values..."
+     cf = ConfigParser.ConfigParser()
+     sio = StringIO.StringIO(src)
+     cf.readfp(sio)
+     for x in range(1, 5):
+         verify(cf.getboolean('BOOLTEST', 't%d' % (x)) == 1)
+     for x in range(1, 5):
+         verify(cf.getboolean('BOOLTEST', 'f%d' % (x)) == 0)
+     for x in range(1, 5):
+         try:
+             cf.getboolean('BOOLTEST', 'e%d' % (x))
+         except ValueError:
+             pass
+         else:
+             raise TestFailed(
+                 "getboolean() failed to report a non boolean value")
+ 
+ 
  def interpolation(src):
      print "Testing value interpolation..."
***************
*** 181,184 ****
--- 200,221 ----
  """)
  case_sensitivity()
+ boolean(r"""
+ [BOOLTEST]
+ T1=1
+ T2=TRUE
+ T3=True
+ T4=oN
+ T5=yes
+ F1=0
+ F2=FALSE
+ F3=False
+ F4=oFF
+ F5=nO
+ E1=2
+ E2=foo
+ E3=-1
+ E4=0.1
+ E5=FALSE AND MORE
+ """)
  interpolation(r"""
  [Foo]