diff options
author | terryjreedy <tjreedy@udel.edu> | 2017-06-27 05:23:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-27 05:23:55 (GMT) |
commit | 44913e584bcf4e2a0e1a6372c304c2d5ea521fc6 (patch) | |
tree | 5018d181ec979f5783b782b6f00b263cd87ed744 /Lib/idlelib/idle_test/test_config_key.py | |
parent | 213ce12adfc9281c6f381bb45d132e9de8ffd450 (diff) | |
download | cpython-44913e584bcf4e2a0e1a6372c304c2d5ea521fc6.zip cpython-44913e584bcf4e2a0e1a6372c304c2d5ea521fc6.tar.gz cpython-44913e584bcf4e2a0e1a6372c304c2d5ea521fc6.tar.bz2 |
bpo-21519: IDLE basic custom key entry better detects duplicates. (#2428)
Diffstat (limited to 'Lib/idlelib/idle_test/test_config_key.py')
-rw-r--r-- | Lib/idlelib/idle_test/test_config_key.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Lib/idlelib/idle_test/test_config_key.py b/Lib/idlelib/idle_test/test_config_key.py index a4227ed..9074e23 100644 --- a/Lib/idlelib/idle_test/test_config_key.py +++ b/Lib/idlelib/idle_test/test_config_key.py @@ -28,8 +28,9 @@ class ValidationTest(unittest.TestCase): requires('gui') cls.root = Tk() cls.root.withdraw() + keylist = [['<Key-F12>'], ['<Control-Key-x>', '<Control-Key-X>']] cls.dialog = cls.Validator( - cls.root, 'Title', '<<Test>>', [['<Key-F12>']], _utest=True) + cls.root, 'Title', '<<Test>>', keylist, _utest=True) @classmethod def tearDownClass(cls): @@ -78,10 +79,15 @@ class ValidationTest(unittest.TestCase): self.dialog.GetModifiers.result = [] def test_keys_dup(self): - self.dialog.listKeysFinal.get.result = 'F12' + 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.assertIn('already in use', self.dialog.showerror.message) self.dialog.GetModifiers.result = [] - self.assertFalse(self.dialog.KeysOK('<Key-F12>')) - self.assertIn('already in use', self.dialog.showerror.message) def test_bind_ok(self): self.assertTrue(self.dialog.bind_ok('<Control-Shift-Key-a>')) |