summaryrefslogtreecommitdiff
path: root/Lib/test/test_configparser.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_configparser.py')
-rw-r--r--Lib/test/test_configparser.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_configparser.py b/Lib/test/test_configparser.py
index 72c3f19fb4..be22fa4031 100644
--- a/Lib/test/test_configparser.py
+++ b/Lib/test/test_configparser.py
@@ -855,6 +855,15 @@ boolean {0[0]} NO
self.assertEqual(cf.get('DEFAULT', 'test'), 'test')
self.assertEqual(cf['DEFAULT']['test'], 'test')
+ def test_defaults_keyword(self):
+ # test that bpo-23835 is fixed
+ cf = self.newconfig(defaults={1: 2.4})
+ self.assertEqual(cf[self.default_section]['1'], '2.4')
+ self.assertAlmostEqual(cf[self.default_section].getfloat('1'), 2.4)
+ cf = self.newconfig(defaults={"A": 5.2})
+ self.assertEqual(cf[self.default_section]['a'], '5.2')
+ self.assertAlmostEqual(cf[self.default_section].getfloat('a'), 5.2)
+
class StrictTestCase(BasicTestCase, unittest.TestCase):
config_class = configparser.RawConfigParser