Allow strings in keymap. Replace with keys in keyboard _init cycle.

This commit is contained in:
John Morrison
2022-04-25 20:16:48 +01:00
committed by xs5871
parent a4d6a44a04
commit 9f964aba36
4 changed files with 43 additions and 6 deletions

View File

@@ -10,6 +10,19 @@ class TestKmkKeyboard(unittest.TestCase):
keyboard.test('Simple key press', [(0, True), (0, False)], [{KC.N1}, {}])
def test_basic_kmk_keyboard_replace_string_primary_name(self):
keyboard = KeyboardTest([], [['1', '2', '3', '4']])
keyboard.test('Simple key press', [(0, True), (0, False)], [{KC.N1}, {}])
def test_basic_kmk_keyboard_replace_string_secondary_name(self):
keyboard = KeyboardTest([], [['N1', 'N2', 'N3', 'N4']])
keyboard.test('Simple key press', [(0, True), (0, False)], [{KC.N1}, {}])
def test_basic_kmk_keyboard_unknown_replacement_string(self):
with self.assertRaises(ValueError):
KeyboardTest([], [['UNKNOWN1', 'UNKNOWN2', 'UNKNOWN3', 'UNKNOWN4']])
if __name__ == '__main__':
unittest.main()