diff options
author | Cheryl Sabella <cheryl.sabella@gmail.com> | 2018-12-28 03:47:54 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2018-12-28 03:47:54 (GMT) |
commit | 55698cc39549523cafc13cc8dd47960d8f73a59f (patch) | |
tree | eb0e5390a9ec38d152f0624638163126deb82aa1 /Lib/idlelib/idle_test | |
parent | 0133f9fc9e8a35b223341d7b5641ac2f16ff2a19 (diff) | |
download | cpython-55698cc39549523cafc13cc8dd47960d8f73a59f.zip cpython-55698cc39549523cafc13cc8dd47960d8f73a59f.tar.gz cpython-55698cc39549523cafc13cc8dd47960d8f73a59f.tar.bz2 |
bpo-35598: IDLE: Update config_key.py with PEP8 names (GH-11330)
A few other changes make the code easier to follow.
Diffstat (limited to 'Lib/idlelib/idle_test')
-rw-r--r-- | Lib/idlelib/idle_test/htest.py | 3 | ||||
-rw-r--r-- | Lib/idlelib/idle_test/test_config_key.py | 48 |
2 files changed, 25 insertions, 26 deletions
diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py index 583e607..429081f 100644 --- a/Lib/idlelib/idle_test/htest.py +++ b/Lib/idlelib/idle_test/htest.py @@ -141,12 +141,11 @@ _editor_window_spec = { "Best to close editor first." } -# Update once issue21519 is resolved. GetKeysDialog_spec = { 'file': 'config_key', 'kwds': {'title': 'Test keybindings', 'action': 'find-again', - 'currentKeySequences': [''] , + 'current_key_sequences': [['<Control-Key-g>', '<Key-F3>', '<Control-Key-G>']], '_htest': True, }, 'msg': "Test for different key modifier sequences.\n" diff --git a/Lib/idlelib/idle_test/test_config_key.py b/Lib/idlelib/idle_test/test_config_key.py index abe5749..adf02c9 100644 --- a/Lib/idlelib/idle_test/test_config_key.py +++ b/Lib/idlelib/idle_test/test_config_key.py @@ -1,4 +1,4 @@ -"Test config_key, coverage 75%" +"Test config_key, coverage 82%" from idlelib import config_key from test.support import requires @@ -9,15 +9,15 @@ from idlelib.idle_test.mock_tk import Mbox_func class ValidationTest(unittest.TestCase): - "Test validation methods: OK, KeysOK, bind_ok." + "Test validation methods: ok, keys_ok, bind_ok." class Validator(config_key.GetKeysDialog): def __init__(self, *args, **kwargs): config_key.GetKeysDialog.__init__(self, *args, **kwargs) - class listKeysFinal: + class list_keys_final: get = Func() - self.listKeysFinal = listKeysFinal - GetModifiers = Func() + self.list_keys_final = list_keys_final + get_modifiers = Func() showerror = Mbox_func() @classmethod @@ -31,7 +31,7 @@ class ValidationTest(unittest.TestCase): @classmethod def tearDownClass(cls): - cls.dialog.Cancel() + cls.dialog.cancel() cls.root.update_idletasks() cls.root.destroy() del cls.dialog, cls.root @@ -42,49 +42,49 @@ class ValidationTest(unittest.TestCase): # A test that sets a non-blank modifier list should reset it to []. def test_ok_empty(self): - self.dialog.keyString.set(' ') - self.dialog.OK() + self.dialog.key_string.set(' ') + self.dialog.ok() self.assertEqual(self.dialog.result, '') self.assertEqual(self.dialog.showerror.message, 'No key specified.') def test_ok_good(self): - self.dialog.keyString.set('<Key-F11>') - self.dialog.listKeysFinal.get.result = 'F11' - self.dialog.OK() + self.dialog.key_string.set('<Key-F11>') + self.dialog.list_keys_final.get.result = 'F11' + self.dialog.ok() self.assertEqual(self.dialog.result, '<Key-F11>') self.assertEqual(self.dialog.showerror.message, '') def test_keys_no_ending(self): - self.assertFalse(self.dialog.KeysOK('<Control-Shift')) + self.assertFalse(self.dialog.keys_ok('<Control-Shift')) self.assertIn('Missing the final', self.dialog.showerror.message) def test_keys_no_modifier_bad(self): - self.dialog.listKeysFinal.get.result = 'A' - self.assertFalse(self.dialog.KeysOK('<Key-A>')) + self.dialog.list_keys_final.get.result = 'A' + self.assertFalse(self.dialog.keys_ok('<Key-A>')) self.assertIn('No modifier', self.dialog.showerror.message) def test_keys_no_modifier_ok(self): - self.dialog.listKeysFinal.get.result = 'F11' - self.assertTrue(self.dialog.KeysOK('<Key-F11>')) + self.dialog.list_keys_final.get.result = 'F11' + self.assertTrue(self.dialog.keys_ok('<Key-F11>')) self.assertEqual(self.dialog.showerror.message, '') def test_keys_shift_bad(self): - self.dialog.listKeysFinal.get.result = 'a' - self.dialog.GetModifiers.result = ['Shift'] - self.assertFalse(self.dialog.KeysOK('<a>')) + self.dialog.list_keys_final.get.result = 'a' + self.dialog.get_modifiers.result = ['Shift'] + self.assertFalse(self.dialog.keys_ok('<a>')) self.assertIn('shift modifier', self.dialog.showerror.message) - self.dialog.GetModifiers.result = [] + self.dialog.get_modifiers.result = [] def test_keys_dup(self): for mods, final, seq in (([], 'F12', '<Key-F12>'), (['Control'], 'x', '<Control-Key-x>'), (['Control'], 'X', '<Control-Key-X>')): with self.subTest(m=mods, f=final, s=seq): - self.dialog.listKeysFinal.get.result = final - self.dialog.GetModifiers.result = mods - self.assertFalse(self.dialog.KeysOK(seq)) + self.dialog.list_keys_final.get.result = final + self.dialog.get_modifiers.result = mods + self.assertFalse(self.dialog.keys_ok(seq)) self.assertIn('already in use', self.dialog.showerror.message) - self.dialog.GetModifiers.result = [] + self.dialog.get_modifiers.result = [] def test_bind_ok(self): self.assertTrue(self.dialog.bind_ok('<Control-Shift-Key-a>')) |