MCPcopy Create free account
hub / github.com/python/cpython / test_load_key_cfg

Method test_load_key_cfg

Lib/idlelib/idle_test/test_configdialog.py:800–840  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

798 d.load_keys_list.called = 0
799
800 def test_load_key_cfg(self):
801 tracers.detach()
802 d = self.page
803 eq = self.assertEqual
804
805 # Use builtin keyset with no user keysets created.
806 idleConf.CurrentKeys = mock.Mock(return_value='IDLE Classic OSX')
807 d.load_key_cfg()
808 self.assertTrue(d.keyset_source.get())
809 # builtinlist sets variable builtin_name to the CurrentKeys default.
810 eq(d.builtin_name.get(), 'IDLE Classic OSX')
811 eq(d.custom_name.get(), '- no custom keys -')
812 eq(d.custom_keyset_on.state(), ('disabled',))
813 eq(d.set_keys_type.called, 1)
814 eq(d.load_keys_list.called, 1)
815 eq(d.load_keys_list.args, ('IDLE Classic OSX', ))
816
817 # Builtin keyset with non-empty user keyset list.
818 idleConf.SetOption('keys', 'test1', 'option', 'value')
819 idleConf.SetOption('keys', 'test2', 'option2', 'value2')
820 d.load_key_cfg()
821 eq(d.builtin_name.get(), 'IDLE Classic OSX')
822 eq(d.custom_name.get(), 'test1')
823 eq(d.set_keys_type.called, 2)
824 eq(d.load_keys_list.called, 2)
825 eq(d.load_keys_list.args, ('IDLE Classic OSX', ))
826
827 # Use custom keyset.
828 idleConf.CurrentKeys = mock.Mock(return_value='test2')
829 idleConf.default_keys = mock.Mock(return_value='IDLE Modern Unix')
830 idleConf.SetOption('main', 'Keys', 'default', '0')
831 d.load_key_cfg()
832 self.assertFalse(d.keyset_source.get())
833 eq(d.builtin_name.get(), 'IDLE Modern Unix')
834 eq(d.custom_name.get(), 'test2')
835 eq(d.set_keys_type.called, 3)
836 eq(d.load_keys_list.called, 3)
837 eq(d.load_keys_list.args, ('test2', ))
838
839 del idleConf.CurrentKeys, idleConf.default_keys
840 tracers.attach()
841
842 def test_keyset_source(self):
843 eq = self.assertEqual

Callers

nothing calls this directly

Calls 9

eqFunction · 0.85
load_key_cfgMethod · 0.80
assertTrueMethod · 0.80
assertFalseMethod · 0.80
detachMethod · 0.45
getMethod · 0.45
stateMethod · 0.45
SetOptionMethod · 0.45
attachMethod · 0.45

Tested by

no test coverage detected