summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_cfgparser.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-12-04 16:30:40 (GMT)
committerFred Drake <fdrake@acm.org>2000-12-04 16:30:40 (GMT)
commit3d5f7e83c74c1c2fa20cf23d38020bbefb69916e (patch)
tree0251e637fb826fe26c8f375b39a6359cfa5a2e46 /Lib/test/test_cfgparser.py
parentff4a23bbcb08e7dbb48fa8b5cfbafaea11e1f8c7 (diff)
downloadcpython-3d5f7e83c74c1c2fa20cf23d38020bbefb69916e.zip
cpython-3d5f7e83c74c1c2fa20cf23d38020bbefb69916e.tar.gz
cpython-3d5f7e83c74c1c2fa20cf23d38020bbefb69916e.tar.bz2
Add test cases for ConfigParser.remove_option() behavior. This includes
coverage to ensure bug #124324 does not re-surface.
Diffstat (limited to 'Lib/test/test_cfgparser.py')
-rw-r--r--Lib/test/test_cfgparser.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_cfgparser.py b/Lib/test/test_cfgparser.py
index 00b8465..bd06d3b 100644
--- a/Lib/test/test_cfgparser.py
+++ b/Lib/test/test_cfgparser.py
@@ -1,6 +1,9 @@
import ConfigParser
import StringIO
+from test_support import TestFailed
+
+
def basic(src):
print
print "Testing basic accessors..."
@@ -25,6 +28,27 @@ def basic(src):
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):
print
print "Testing value interpolation..."