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

Method test_load_keys_list

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

Source from the content-addressed store, hash-verified

1077 eq(idleConf.GetKeySet(first_new), idleConf.GetKeySet(second_new))
1078
1079 def test_load_keys_list(self):
1080 eq = self.assertEqual
1081 d = self.page
1082 gks = idleConf.GetKeySet = Func()
1083 del d.load_keys_list
1084 b = d.bindingslist
1085
1086 b.delete(0, 'end')
1087 b.insert(0, '<<find>>')
1088 b.insert(1, '<<help>>')
1089 gks.result = {'<<copy>>': ['<Control-Key-c>', '<Control-Key-C>'],
1090 '<<force-open-completions>>': ['<Control-Key-space>'],
1091 '<<spam>>': ['<Key-F11>']}
1092 changes.add_option('keys', 'my keys', 'spam', '<Shift-Key-a>')
1093 expected = ('copy - <Control-Key-c> <Control-Key-C>',
1094 'force-open-completions - <Control-Key-space>',
1095 'spam - <Shift-Key-a>')
1096
1097 # No current selection.
1098 d.load_keys_list('my keys')
1099 eq(b.get(0, 'end'), expected)
1100 eq(b.get('anchor'), '')
1101 eq(b.curselection(), ())
1102
1103 # Check selection.
1104 b.selection_set(1)
1105 b.selection_anchor(1)
1106 d.load_keys_list('my keys')
1107 eq(b.get(0, 'end'), expected)
1108 eq(b.get('anchor'), 'force-open-completions - <Control-Key-space>')
1109 eq(b.curselection(), (1, ))
1110
1111 # Change selection.
1112 b.selection_set(2)
1113 b.selection_anchor(2)
1114 d.load_keys_list('my keys')
1115 eq(b.get(0, 'end'), expected)
1116 eq(b.get('anchor'), 'spam - <Shift-Key-a>')
1117 eq(b.curselection(), (2, ))
1118 d.load_keys_list = Func()
1119
1120 del idleConf.GetKeySet
1121
1122 def test_delete_custom_keys(self):
1123 eq = self.assertEqual

Callers

nothing calls this directly

Calls 10

FuncClass · 0.90
eqFunction · 0.85
load_keys_listMethod · 0.80
curselectionMethod · 0.80
selection_anchorMethod · 0.80
deleteMethod · 0.45
insertMethod · 0.45
add_optionMethod · 0.45
getMethod · 0.45
selection_setMethod · 0.45

Tested by

no test coverage detected