summaryrefslogtreecommitdiff
path: root/Lib/test/test_configparser.py
diff options
context:
space:
mode:
authorCheryl Sabella <cheryl.sabella@gmail.com>2018-06-12 16:37:51 -0400
committerƁukasz Langa <lukasz@langa.pl>2018-06-12 13:37:51 -0700
commit33cd058f21d0673253c88cea70388282918992bc (patch)
tree939d1aa091d5b69bafc4f75e68acd3aedbdbbfe0 /Lib/test/test_configparser.py
parentc3f55be7dd012b7e92901627d0b31c21e983ccb4 (diff)
downloadcpython-git-33cd058f21d0673253c88cea70388282918992bc.tar.gz
bpo-32108: Don't clear configparser values if key is assigned to itself (GH-7588)
Diffstat (limited to 'Lib/test/test_configparser.py')
-rw-r--r--Lib/test/test_configparser.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_configparser.py b/Lib/test/test_configparser.py
index f4df622050..f16da116a7 100644
--- a/Lib/test/test_configparser.py
+++ b/Lib/test/test_configparser.py
@@ -850,12 +850,18 @@ boolean {0[0]} NO
self.assertEqual(set(cf['section3'].keys()), {'named'})
self.assertNotIn('name3', cf['section3'])
self.assertEqual(cf.sections(), ['section1', 'section2', 'section3'])
+ # For bpo-32108, assigning default_section to itself.
+ cf[self.default_section] = cf[self.default_section]
+ self.assertNotEqual(set(cf[self.default_section].keys()), set())
cf[self.default_section] = {}
self.assertEqual(set(cf[self.default_section].keys()), set())
self.assertEqual(set(cf['section1'].keys()), {'name1'})
self.assertEqual(set(cf['section2'].keys()), {'name22'})
self.assertEqual(set(cf['section3'].keys()), set())
self.assertEqual(cf.sections(), ['section1', 'section2', 'section3'])
+ # For bpo-32108, assigning section to itself.
+ cf['section2'] = cf['section2']
+ self.assertEqual(set(cf['section2'].keys()), {'name22'})
def test_invalid_multiline_value(self):
if self.allow_no_value: