Skip to content
Merged
Prev Previous commit
Next Next commit
Eliminate reason to test with duplicate new names.
  • Loading branch information
terryjreedy committed Jan 26, 2020
commit 0b234eb6ca9895523a48787b4ecfa3d2bd7c54a3
3 changes: 1 addition & 2 deletions Lib/idlelib/configdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -1286,8 +1286,7 @@ def save_new(self, theme_name, theme):
theme_name - string, the name of the new theme
theme - dictionary containing the new theme
"""
if not idleConf.userCfg['highlight'].has_section(theme_name):
idleConf.userCfg['highlight'].add_section(theme_name)
idleConf.userCfg['highlight'].AddSection(theme_name)
for element in theme:
value = theme[element]
idleConf.userCfg['highlight'].SetOption(theme_name, element, value)
Expand Down
11 changes: 0 additions & 11 deletions Lib/idlelib/idle_test/test_configdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,17 +1100,6 @@ def test_create_new_key_set_and_save_new_key_set(self):
self.assertFalse(d.keyset_source.get()) # Use custom set.
eq(d.set_keys_type.called, 1)

# Call with same name as first time to make sure it adds it only once.
d.keyset_source.set(True)
d.builtin_name.set('IDLE Classic Windows')
d.create_new_key_set(first_new)
eq(idleConf.GetSectionList('user', 'keys'), [first_new])
eq(idleConf.GetKeySet('IDLE Classic Windows'),
idleConf.GetKeySet(first_new))
eq(d.custom_name.get(), first_new)
self.assertFalse(d.keyset_source.get()) # Use custom set.
eq(d.set_keys_type.called, 2)

# Test that changed keybindings are in new keyset.
changes.add_option('keys', first_new, 'copy', '<Key-F11>')
self.assertNotIn(second_new, idleConf.userCfg)
Expand Down