@@ -7,11 +7,14 @@ def test_list_integrity():
77 for mode , cmds in enumerate (obd .commands .modes ):
88 for pid , cmd in enumerate (cmds ):
99
10+ if cmd is None :
11+ continue # this command is reserved
12+
1013 assert cmd .command != "" , "The Command's command string must not be null"
1114
1215 # make sure the command tables are in mode & PID order
13- assert mode == cmd .mode_int , "Command is in the wrong mode list: %s" % cmd .name
14- assert pid == cmd .pid_int , "The index in the list must also be the PID: %s" % cmd .name
16+ assert mode == cmd .mode , "Command is in the wrong mode list: %s" % cmd .name
17+ assert pid == cmd .pid , "The index in the list must also be the PID: %s" % cmd .name
1518
1619 # make sure all the fields are set
1720 assert cmd .name != "" , "Command names must not be null"
@@ -30,6 +33,10 @@ def test_unique_names():
3033
3134 for cmds in obd .commands .modes :
3235 for cmd in cmds :
36+
37+ if cmd is None :
38+ continue # this command is reserved
39+
3340 assert not names .__contains__ (cmd .name ), "Two commands share the same name: %s" % cmd .name
3441 names [cmd .name ] = True
3542
@@ -39,9 +46,12 @@ def test_getitem():
3946 for cmds in obd .commands .modes :
4047 for cmd in cmds :
4148
49+ if cmd is None :
50+ continue # this command is reserved
51+
4252 # by [mode][pid]
43- mode = cmd .mode_int
44- pid = cmd .pid_int
53+ mode = cmd .mode
54+ pid = cmd .pid
4555 assert cmd == obd .commands [mode ][pid ], "mode %d, PID %d could not be accessed through __getitem__" % (mode , pid )
4656
4757 # by [name]
@@ -53,12 +63,15 @@ def test_contains():
5363 for cmds in obd .commands .modes :
5464 for cmd in cmds :
5565
66+ if cmd is None :
67+ continue # this command is reserved
68+
5669 # by (command)
5770 assert obd .commands .has_command (cmd )
5871
5972 # by (mode, pid)
60- mode = cmd .mode_int
61- pid = cmd .pid_int
73+ mode = cmd .mode
74+ pid = cmd .pid
6275 assert obd .commands .has_pid (mode , pid )
6376
6477 # by (name)
@@ -78,7 +91,11 @@ def test_pid_getters():
7891 # ensure that all pid getters are found
7992 pid_getters = obd .commands .pid_getters ()
8093
81- for cmds in obd .commands .modes :
82- for cmd in cmds :
94+ for mode in obd .commands .modes :
95+ for cmd in mode :
96+
97+ if cmd is None :
98+ continue # this command is reserved
99+
83100 if cmd .decode == pid :
84101 assert cmd in pid_getters
0 commit comments