|
1 |
| -from typing import Any, Dict |
| 1 | +from typing import Any, Dict, List |
2 | 2 |
|
3 | 3 | import pytest
|
4 | 4 | from pytest_mock import MockerFixture
|
@@ -139,3 +139,25 @@ def test_updated_urwid_command_map() -> None:
|
139 | 139 | )
|
140 | 140 | def test_display_key_for_urwid_key(urwid_key: str, display_key: str) -> None:
|
141 | 141 | assert keys.display_key_for_urwid_key(urwid_key) == display_key
|
| 142 | + |
| 143 | + |
| 144 | +COMMAND_TO_DISPLAY_KEYS = [ |
| 145 | + ("NEXT_LINE", ["Down", "Ctrl n"]), |
| 146 | + ("TOGGLE_STAR_STATUS", ["Ctrl s", "*"]), |
| 147 | + ("ALL_PM", ["P"]), |
| 148 | +] |
| 149 | + |
| 150 | + |
| 151 | +@pytest.mark.parametrize("command, display_keys", COMMAND_TO_DISPLAY_KEYS) |
| 152 | +def test_display_keys_for_command(command: str, display_keys: List[str]) -> None: |
| 153 | + assert keys.display_keys_for_command(command) == display_keys |
| 154 | + |
| 155 | + |
| 156 | +@pytest.mark.parametrize("command, display_keys", COMMAND_TO_DISPLAY_KEYS) |
| 157 | +def test_primary_display_key_for_command(command: str, display_keys: List[str]) -> None: |
| 158 | + assert keys.primary_display_key_for_command(command) == display_keys[0] |
| 159 | + |
| 160 | + |
| 161 | +def test_display_keys_for_command_invalid_command(invalid_command: str) -> None: |
| 162 | + with pytest.raises(keys.InvalidCommand): |
| 163 | + keys.display_keys_for_command(invalid_command) |
0 commit comments