summaryrefslogtreecommitdiff
path: root/Lib/test/test_cfgparser.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2010-08-10 13:09:54 +0000
committerFred Drake <fdrake@acm.org>2010-08-10 13:09:54 +0000
commit0a1fa0e8b1fc888ae9978003c836e5a1953daef5 (patch)
treeb0441f342d177dea92c26fd8724e0b64ca8a2a28 /Lib/test/test_cfgparser.py
parent2d930804ffdb2f279c7306532dba09de972cf885 (diff)
downloadcpython-git-0a1fa0e8b1fc888ae9978003c836e5a1953daef5.tar.gz
Issue #9551: Do not raise TypeError when setting the value to None for
SafeConfigParser instances constructed with allow_no_value == True.
Diffstat (limited to 'Lib/test/test_cfgparser.py')
-rw-r--r--Lib/test/test_cfgparser.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_cfgparser.py b/Lib/test/test_cfgparser.py
index 22a314d779..5417d247fd 100644
--- a/Lib/test/test_cfgparser.py
+++ b/Lib/test/test_cfgparser.py
@@ -357,6 +357,7 @@ class TestCaseBase(unittest.TestCase):
class ConfigParserTestCase(TestCaseBase):
config_class = ConfigParser.ConfigParser
+ allow_no_value = True
def test_interpolation(self):
rawval = {
@@ -397,6 +398,7 @@ class ConfigParserTestCase(TestCaseBase):
cf.set('non-string', 'dict', {'pi': 3.14159, '%(': 1,
'%(list)': '%(list)'})
cf.set('non-string', 'string_with_interpolation', '%(list)s')
+ cf.set('non-string', 'no-value')
self.assertEqual(cf.get('non-string', 'int', raw=True), 1)
self.assertRaises(TypeError, cf.get, 'non-string', 'int')
self.assertEqual(cf.get('non-string', 'list', raw=True),
@@ -409,6 +411,7 @@ class ConfigParserTestCase(TestCaseBase):
raw=True), '%(list)s')
self.assertRaises(ValueError, cf.get, 'non-string',
'string_with_interpolation', raw=False)
+ self.assertEqual(cf.get('non-string', 'no-value'), None)
class MultilineValuesTestCase(TestCaseBase):
config_class = ConfigParser.ConfigParser