-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_replace_shortcut_names.py
More file actions
67 lines (47 loc) · 2.01 KB
/
test_replace_shortcut_names.py
File metadata and controls
67 lines (47 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""Tests for the replace_shortcut_names function."""
import pytest
from generate_cheatsheet import replace_shortcut_names
def test_three_keys():
"""Test Ctrl+Shift+A -> Ctrl<sep>Shift<sep>A"""
result = replace_shortcut_names("Ctrl+Shift+A", {})
expected = "Ctrl<sep>Shift<sep>A"
assert result == expected
def test_plus_key():
"""Test Ctrl++ -> Ctrl<sep>+"""
result = replace_shortcut_names("Ctrl++", {})
expected = "Ctrl<sep>+"
assert result == expected
def test_angle_bracket():
"""Test CTRL+> -> CTRL<sep>>"""
result = replace_shortcut_names("CTRL+>", {})
expected = "CTRL<sep>>"
assert result == expected
def test_simple_chord():
"""Test Super+T>W>S -> Super<sep>T<seq>W<seq>S"""
result = replace_shortcut_names("Super+T>W>S", {})
expected = "Super<sep>T<seq>W<seq>S"
assert result == expected
def test_composed_chord():
"""Test CTRL+C>CTRL+K -> CTRL<sep>C<seq>CTRL<sep>K"""
result = replace_shortcut_names("CTRL+C>CTRL+K", {})
expected = "CTRL<sep>C<seq>CTRL<sep>K"
assert result == expected
def test_angle_bracket_in_chord():
"""Test CTRL>> -> CTRL<seq>>"""
result = replace_shortcut_names("CTRL>>", {})
expected = "CTRL<seq>>"
assert result == expected
def test_plus_key_in_chord():
"""Test CTRL>+ -> CTRL<seq>+"""
result = replace_shortcut_names("CTRL>+", {})
expected = "CTRL<seq>+"
assert result == expected
def test_spaces():
assert replace_shortcut_names("Ctrl + C", {}) == "Ctrl<sep>C"
assert replace_shortcut_names("Ctrl + Shift + A", {}) == "Ctrl<sep>Shift<sep>A"
assert replace_shortcut_names("Ctrl + +", {}) == "Ctrl<sep>+"
assert replace_shortcut_names("CTRL + >", {}) == "CTRL<sep>>"
assert replace_shortcut_names("Super + T > W > S", {}) == "Super<sep>T<seq>W<seq>S"
assert replace_shortcut_names("CTRL + C > CTRL + K", {}) == "CTRL<sep>C<seq>CTRL<sep>K"
assert replace_shortcut_names("CTRL > >", {}) == "CTRL<seq>>"
assert replace_shortcut_names("CTRL > +", {}) == "CTRL<seq>+"