summaryrefslogtreecommitdiff
path: root/lib/python/qmk
diff options
context:
space:
mode:
authorNiko Wenselowski <niko@nerdno.de>2022-07-23 18:42:19 +0200
committerGitHub <noreply@github.com>2022-07-23 17:42:19 +0100
commit1f42a8ccdd10a1f1ac1ed1a0ab62d2c9e5dc3ffa (patch)
treecd11520ecfcb81466f033b7319d63a1c6b1d6e5e /lib/python/qmk
parent2202efaf0cdae766b76de1f87dc3c440480e5280 (diff)
Fix test logic to check for both keymaps (#17761)
Python will evaluate first the left and then the right side of the and operator. The left side would previously return True based on the truthiness logic that treats any non-emptry string as true. It would not check if the desired keymap exists. If the left side is true it will evaluate the right side which will check for the existance of a specific keymap. With this change the check for existance of two keymaps is implemented.
Diffstat (limited to 'lib/python/qmk')
-rw-r--r--lib/python/qmk/tests/test_cli_commands.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py
index 2463543ef1..fde8b079a3 100644
--- a/lib/python/qmk/tests/test_cli_commands.py
+++ b/lib/python/qmk/tests/test_cli_commands.py
@@ -97,13 +97,15 @@ def test_list_keyboards():
97def test_list_keymaps(): 97def test_list_keymaps():
98 result = check_subcommand('list-keymaps', '-kb', 'handwired/pytest/basic') 98 result = check_subcommand('list-keymaps', '-kb', 'handwired/pytest/basic')
99 check_returncode(result) 99 check_returncode(result)
100 assert 'default' and 'default_json' in result.stdout 100 assert 'default' in result.stdout
101 assert 'default_json' in result.stdout
101 102
102 103
103def test_list_keymaps_long(): 104def test_list_keymaps_long():
104 result = check_subcommand('list-keymaps', '--keyboard', 'handwired/pytest/basic') 105 result = check_subcommand('list-keymaps', '--keyboard', 'handwired/pytest/basic')
105 check_returncode(result) 106 check_returncode(result)
106 assert 'default' and 'default_json' in result.stdout 107 assert 'default' in result.stdout
108 assert 'default_json' in result.stdout
107 109
108 110
109def test_list_keymaps_community(): 111def test_list_keymaps_community():
@@ -115,19 +117,22 @@ def test_list_keymaps_community():
115def test_list_keymaps_kb_only(): 117def test_list_keymaps_kb_only():
116 result = check_subcommand('list-keymaps', '-kb', 'contra') 118 result = check_subcommand('list-keymaps', '-kb', 'contra')
117 check_returncode(result) 119 check_returncode(result)
118 assert 'default' and 'via' in result.stdout 120 assert 'default' in result.stdout
121 assert 'via' in result.stdout
119 122
120 123
121def test_list_keymaps_vendor_kb(): 124def test_list_keymaps_vendor_kb():
122 result = check_subcommand('list-keymaps', '-kb', 'ai03/lunar') 125 result = check_subcommand('list-keymaps', '-kb', 'ai03/lunar')
123 check_returncode(result) 126 check_returncode(result)
124 assert 'default' and 'via' in result.stdout 127 assert 'default' in result.stdout
128 assert 'via' in result.stdout
125 129
126 130
127def test_list_keymaps_vendor_kb_rev(): 131def test_list_keymaps_vendor_kb_rev():
128 result = check_subcommand('list-keymaps', '-kb', 'kbdfans/kbd67/mkiirgb/v2') 132 result = check_subcommand('list-keymaps', '-kb', 'kbdfans/kbd67/mkiirgb/v2')
129 check_returncode(result) 133 check_returncode(result)
130 assert 'default' and 'via' in result.stdout 134 assert 'default' in result.stdout
135 assert 'via' in result.stdout
131 136
132 137
133def test_list_keymaps_no_keyboard_found(): 138def test_list_keymaps_no_keyboard_found():