forked from JeffLIrion/python-androidtv
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_test_constants.py
More file actions
43 lines (33 loc) · 1.21 KB
/
generate_test_constants.py
File metadata and controls
43 lines (33 loc) · 1.21 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
"""Helper script for generating the 'test_constants' test in test_constants.py."""
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from androidtv import constants
EXCLUSIONS = {
"CMD_SUCCESS1",
"CMD_SUCCESS1_FAILURE0",
"CMD_PARSE_CURRENT_APP",
"CMD_PARSE_CURRENT_APP11",
"CMD_PARSE_CURRENT_APP12",
"CMD_PARSE_CURRENT_APP13",
"CMD_DEFINE_CURRENT_APP_VARIABLE",
"CMD_DEFINE_CURRENT_APP_VARIABLE11",
"CMD_DEFINE_CURRENT_APP_VARIABLE12",
"CMD_DEFINE_CURRENT_APP_VARIABLE13",
"CMD_DEFINE_CURRENT_APP_VARIABLE_GOOGLE_TV",
"CMD_LAUNCH_APP_CONDITION",
"CMD_LAUNCH_APP_CONDITION_FIRETV",
}
def get_cmds():
"""Get the ``CMD_*`` constants.
Returns
-------
dict[str: str]
A dictionary where the keys are the names of the constants and the keys are their values
"""
return {var: getattr(constants, var) for var in dir(constants) if var.startswith("CMD_") and var not in EXCLUSIONS}
if __name__ == "__main__":
for name, value in sorted(get_cmds().items(), key=lambda x: x[0]):
print(" # {}".format(name))
print(' self.assertCommand(constants.{}, r"{}")'.format(name, value))
print()