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

Michael Hudson mwh@users.sourceforge.net
Fri, 15 Mar 2002 02:25:14 -0800


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

Modified Files:
      Tag: release22-maint
	test_cfgparser.py 
Log Message:
backport akuchling's checkin of
    revision 1.10 of test_cfgparser.py

As part of fixing bug #523301, add a simple test of ConfigParser.write()


Index: test_cfgparser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cfgparser.py,v
retrieving revision 1.9
retrieving revision 1.9.10.1
diff -C2 -d -r1.9 -r1.9.10.1
*** test_cfgparser.py	8 Oct 2001 17:13:11 -0000	1.9
--- test_cfgparser.py	15 Mar 2002 10:25:12 -0000	1.9.10.1
***************
*** 15,18 ****
--- 15,19 ----
                   r'Foo Bar',
                   r'Internationalized Stuff',
+                  r'Long Line',
                   r'Section\with$weird%characters[' '\t',
                   r'Spacey Bar',
***************
*** 48,52 ****
--- 49,72 ----
              " that never existed")
  
+     verify(cf.get('Long Line', 'foo', raw=1) ==
+            'this line is much, much longer than my editor\nlikes it.')
+ 
+ 
+ def write(src):
+     print "Testing writing of files..."
+     cf = ConfigParser.ConfigParser()
+     sio = StringIO.StringIO(src)
+     cf.readfp(sio)
+     output = StringIO.StringIO()
+     cf.write(output)
+     verify(output, """[DEFAULT]
+ foo = another very
+         long line
  
+ [Long Line]
+ foo = this line is much, much longer than my editor
+         likes it.
+ """)
+            
  def case_sensitivity():
      print "Testing case sensitivity..."
***************
*** 192,195 ****
--- 212,218 ----
  [Commented Bar]
  foo: bar ; comment
+ [Long Line]
+ foo: this line is much, much longer than my editor
+    likes it.
  [Section\with$weird%characters[""" '\t' r"""]
  [Internationalized Stuff]
***************
*** 199,202 ****
--- 222,231 ----
  foo[de]=Deutsch
  """)
+ write("""[Long Line]
+ foo: this line is much, much longer than my editor
+    likes it.
+ [DEFAULT]
+ foo: another very
+  long line""")
  case_sensitivity()
  boolean(r"""