import pytest

# TODO: Change this later to use the installed library
from src.logiledpy import keys

test_keys = [
    "ESC",
    "F1",
    "F2",
    "F3",
    "F4",
    "F5",
    "F6",
    "F7",
    "F8",
    "F9",
    "F10",
    "F11",
    "F12",
    "PRINT_SCREEN",
    "SCROLL_LOCK",
    "PAUSE_BREAK",
    "TILDE",
    "ONE",
    "TWO",
    "THREE",
    "FOUR",
    "FIVE",
    "SIX",
    "SEVEN",
    "EIGHT",
    "NINE",
    "ZERO",
    "MINUS",
    "EQUALS",
    "BACKSPACE",
    "INSERT",
    "HOME",
    "PAGE_UP",
    "NUM_LOCK",
    "NUM_SLASH",
    "NUM_ASTERISK",
    "NUM_MINUS",
    "TAB",
    "Q",
    "W",
    "E",
    "R",
    "T",
    "Y",
    "U",
    "I",
    "O",
    "P",
    "OPEN_BRACKET",
    "CLOSE_BRACKET",
    "BACKSLASH",
    "KEYBOARD_DELETE",
    "END",
    "PAGE_DOWN",
    "NUM_SEVEN",
    "NUM_EIGHT",
    "NUM_NINE",
    "NUM_PLUS",
    "CAPS_LOCK",
    "A",
    "S",
    "D",
    "F",
    "G",
    "H",
    "J",
    "K",
    "L",
    "SEMICOLON",
    "APOSTROPHE",
    "ENTER",
    "NUM_FOUR",
    "NUM_FIVE",
    "NUM_SIX",
    "LEFT_SHIFT",
    "Z",
    "X",
    "C",
    "V",
    "B",
    "N",
    "M",
    "COMMA",
    "PERIOD",
    "FORWARD_SLASH",
    "RIGHT_SHIFT",
    "ARROW_UP",
    "NUM_ONE",
    "NUM_TWO",
    "NUM_THREE",
    "NUM_ENTER",
    "LEFT_CONTROL",
    "LEFT_WINDOWS",
    "LEFT_ALT",
    "SPACE",
    "RIGHT_ALT",
    "RIGHT_WINDOWS",
    "APPLICATION_SELECT",
    "RIGHT_CONTROL",
    "ARROW_LEFT",
    "ARROW_DOWN",
    "ARROW_RIGHT",
    "NUM_ZERO",
    "NUM_PERIOD",
    "G_1",
    "G_2",
    "G_3",
    "G_4",
    "G_5",
    "G_6",
    "G_7",
    "G_8",
    "G_9",
    "G_LOGO",
    "G_BADGE",
]


def test_get_existing_key():
    for k in test_keys:
        keys.key(k)
        keys.key(k.lower())


def test_get_nonexisting_key():
    nonexisting = ["ü", "ß", "ö", "ä"]

    for k in nonexisting:
        with pytest.raises(KeyError):
            keys.key(k)
