[Python-checkins] CVS: python/dist/src/Lib/test test_cfgparser.py,1.3,1.4
Fred L. Drake
python-dev@python.org
Mon, 4 Dec 2000 08:30:43 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv23878/test
Modified Files:
test_cfgparser.py
Log Message:
Add test cases for ConfigParser.remove_option() behavior. This includes
coverage to ensure bug #124324 does not re-surface.
Index: test_cfgparser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cfgparser.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** test_cfgparser.py 2000/10/23 17:22:07 1.3
--- test_cfgparser.py 2000/12/04 16:30:40 1.4
***************
*** 2,5 ****
--- 2,8 ----
import StringIO
+ from test_support import TestFailed
+
+
def basic(src):
print
***************
*** 25,28 ****
--- 28,52 ----
else:
print '__name__ "option" properly hidden by the API.'
+
+ # Make sure the right things happen for remove_option();
+ # added to include check for SourceForge bug #123324:
+ if not cf.remove_option('Foo Bar', 'foo'):
+ raise TestFailed(
+ "remove_option() failed to report existance of option")
+ if cf.has_option('Foo Bar', 'foo'):
+ raise TestFailed("remove_option() failed to remove option")
+ if cf.remove_option('Foo Bar', 'foo'):
+ raise TestFailed(
+ "remove_option() failed to report non-existance of option"
+ " that was removed")
+ try:
+ cf.remove_option('No Such Section', 'foo')
+ except ConfigParser.NoSectionError:
+ pass
+ else:
+ raise TestFailed(
+ "remove_option() failed to report non-existance of option"
+ " that never existed")
+
def interpolation(src):