mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-23835: Enforce that configparser defaults are strings (#2558)
* Enforce that configparser defaults are strings * Update test_configparser.py
This commit is contained in:
parent
9a83f651f3
commit
44e6ad8734
2 changed files with 11 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue