2 File in charge of testing the variables class
7sys.path.append(os.path.join(
"..", os.getcwd()))
8sys.path.append(os.getcwd())
11 import constants
as TCONST
12except ImportError
as e:
13 raise ImportError(
"Failed to import the unit test constants module")
from e
17except ImportError
as e:
18 raise ImportError(
"Failed to import the src module")
from e
22SUCCESS = TCONST.SUCCESS
25spaceship = ACONST._spaceship
30 Function in charge of testing the log types.
32 assert ACONST.TYPE_UNKNOWN ==
"UNKNOWN LOGGING TYPE"
33 assert ACONST.TYPE_API ==
"API"
34 assert ACONST.TYPE_SERVICE ==
"SERVICE"
35 assert ACONST.TYPE_SERVICE_TRIGGER ==
"SERVICE TRIGGER"
36 assert ACONST.TYPE_SERVICE_ACTION ==
"SERVICE ACTION"
37 assert ACONST.TYPE_ACTION ==
"ACTION"
38 assert ACONST.TYPE_UNDEFINED ==
"UNDEFINED"
39 assert ACONST.TYPE_MISMATCH ==
"MISMATCH"
40 assert ACONST.TYPE_BEFORE_ASSIGNEMENT ==
"REFERENCED BEFORE ASSIGNEMENT"
41 assert ACONST.TYPE_DIV_ZERO ==
"DIVISION BY ZERO"
42 assert ACONST.TYPE_SYNTAX_ERROR ==
"SYNTAX ERROR"
43 assert ACONST.TYPE_RUNTIME_ERROR ==
"RUNTIME ERROR"
44 assert ACONST.TYPE_INCOMPARABLE ==
"INCOMPARABLE TYPES"
45 assert ACONST.TYPE_OVERFLOW ==
"VALUE OVERFLOW"
46 assert ACONST.TYPE_UNDERFLOW ==
"VALUE UNDERFLOW"
51 Function in charge of testing the error codes.
53 assert ACONST.CODE_UNKNOWN == -1
54 assert ACONST.CODE_INFO == 0
55 assert ACONST.CODE_SUCCESS == 1
56 assert ACONST.CODE_DEBUG == 2
57 assert ACONST.CODE_WARNING == 3
58 assert ACONST.CODE_ERROR == 4
59 assert ACONST.CODE_CRITICAL == 5
60 assert ACONST.CODE_FATAL == 6
65 Function in charge of testing the error levels.
67 assert ACONST.LEVEL_UNKNOWN ==
"UNKNOWN"
68 assert ACONST.LEVEL_INFO ==
"INFO"
69 assert ACONST.LEVEL_SUCCESS ==
"SUCCESS"
70 assert ACONST.LEVEL_DEBUG ==
"DEBUG"
71 assert ACONST.LEVEL_WARNING ==
"WARNING"
72 assert ACONST.LEVEL_ERROR ==
"ERROR"
73 assert ACONST.LEVEL_CRITICAL ==
"CRITICAL"
74 assert ACONST.LEVEL_FATAL ==
"FATAL"
79 Function in charge of testing the error messages.
81 assert ACONST.MSG_UNKNOWN ==
"Unknown: Operation executed with unknown status."
82 assert ACONST.MSG_INFO ==
"Information: Operation executed without any issues."
83 assert ACONST.MSG_SUCCESS ==
"Success: Operation completed successfully."
84 assert ACONST.MSG_DEBUG ==
"Debug: Tracking detailed operational data for diagnostics."
85 assert ACONST.MSG_WARNING ==
"Warning: Potential issue detected. Review is recommended."
86 assert ACONST.MSG_ERROR ==
"Error: Operation could not be completed successfully."
87 assert ACONST.MSG_CRITICAL ==
"Critical: Immediate attention required to prevent severe impact."
88 assert ACONST.MSG_FATAL ==
"Fatal: System failure imminent. Immediate intervention necessary."
93 Function in charge of testing the error equivalence.
95 assert ACONST.LOG_EQUIVALENCE == {
96 ACONST.CODE_UNKNOWN: ACONST.LEVEL_UNKNOWN,
97 ACONST.CODE_INFO: ACONST.LEVEL_INFO,
98 ACONST.CODE_SUCCESS: ACONST.LEVEL_SUCCESS,
99 ACONST.CODE_DEBUG: ACONST.LEVEL_DEBUG,
100 ACONST.CODE_WARNING: ACONST.LEVEL_WARNING,
101 ACONST.CODE_ERROR: ACONST.LEVEL_ERROR,
102 ACONST.CODE_CRITICAL: ACONST.LEVEL_CRITICAL,
103 ACONST.CODE_FATAL: ACONST.LEVEL_FATAL,
109 Function in charge of testing the error message equivalence.
111 assert ACONST.LOG_MESSAGE_EQUIVALENCE == {
112 ACONST.CODE_UNKNOWN: ACONST.MSG_UNKNOWN,
113 ACONST.CODE_INFO: ACONST.MSG_INFO,
114 ACONST.CODE_SUCCESS: ACONST.MSG_SUCCESS,
115 ACONST.CODE_DEBUG: ACONST.MSG_DEBUG,
116 ACONST.CODE_WARNING: ACONST.MSG_WARNING,
117 ACONST.CODE_ERROR: ACONST.MSG_ERROR,
118 ACONST.CODE_CRITICAL: ACONST.MSG_CRITICAL,
119 ACONST.CODE_FATAL: ACONST.MSG_FATAL,
125 Function in charge of testing the list type equivalence.
127 assert ACONST.LIST_TYPE == [
131 ACONST.TYPE_SERVICE_TRIGGER,
132 ACONST.TYPE_SERVICE_ACTION,
134 ACONST.TYPE_UNDEFINED,
135 ACONST.TYPE_MISMATCH,
136 ACONST.TYPE_BEFORE_ASSIGNEMENT,
137 ACONST.TYPE_DIV_ZERO,
138 ACONST.TYPE_SYNTAX_ERROR,
139 ACONST.TYPE_RUNTIME_ERROR,
140 ACONST.TYPE_INCOMPARABLE,
141 ACONST.TYPE_OVERFLOW,
142 ACONST.TYPE_UNDERFLOW,
148 Function in charge of testing the list code equivalence.
150 assert ACONST.LIST_CODE == [
157 ACONST.CODE_CRITICAL,
164 Function in charge of testing the list info equivalence.
166 assert ACONST.LIST_LEVEL_INFO == [
167 ACONST.LEVEL_UNKNOWN,
169 ACONST.LEVEL_SUCCESS,
171 ACONST.LEVEL_WARNING,
173 ACONST.LEVEL_CRITICAL,
180 Function in charge of testing the list message equivalence.
182 assert ACONST.LIST_MSG == [
196 Function in charge of testing the spaceship less than operator.
203 Function in charge of testing the spaceship equal operator.
210 Function in charge of testing the spaceship greater than operator.
217 Function in charge of testing the spaceship negative comparison.
224 Function in charge of testing the spaceship zero comparison.
231 Function in charge of testing the spaceship float comparison.
240 Function in charge of testing the spaceship string
242 assert spaceship(
"apple",
"banana") == -1
None test_log_equivalence()
None test_list_info_equivalence()
None test_error_messages()
None test_spaceship_greater_than()
None test_list_code_equivalence()
None test_spaceship_negative_comparison()
None test_spaceship_zero_comparison()
None test_spaceship_equal()
None test_spaceship_less_than()
None test_spaceship_string_comparison()
None test_list_type_equivalence()
None test_spaceship_float_comparison()
None test_log_message_equivalence()
None test_list_msg_equivalence()