@@ -16,32 +16,37 @@ def test_generator(self):
16
16
current_cars_md = f .read ()
17
17
18
18
self .assertEqual (generated_cars_md , current_cars_md ,
19
- "Run selfdrive/car/docs.py to generate new supported cars documentation" )
19
+ "Run selfdrive/car/docs.py to update the compatibility documentation" )
20
20
21
21
def test_missing_car_info (self ):
22
22
all_car_info_platforms = get_interface_attr ("CAR_INFO" , combine_brands = True ).keys ()
23
23
for platform in sorted (interfaces .keys ()):
24
- if platform not in all_car_info_platforms :
25
- self .fail ( "Platform: {} doesn't exist in CarInfo" .format (platform ))
24
+ with self . subTest ( platform = platform ) :
25
+ self .assertTrue ( platform in all_car_info_platforms , "Platform: {} doesn't exist in CarInfo" .format (platform ))
26
26
27
27
def test_naming_conventions (self ):
28
- # Asserts market-standard car naming conventions by make
28
+ # Asserts market-standard car naming conventions by brand
29
29
for car in self .all_cars :
30
- tokens = car .model .lower ().split (" " )
31
- if car .car_name == "hyundai" :
32
- self .assertNotIn ("phev" , tokens , "Use `Plug-in Hybrid`" )
33
- self .assertNotIn ("hev" , tokens , "Use `Hybrid`" )
34
- self .assertNotIn ("ev" , tokens , "Use `Electric`" )
35
- if "plug-in hybrid" in car .model .lower ():
36
- self .assertIn ("Plug-in Hybrid" , car .model , "Use correct capitalization" )
37
- elif car .car_name == "toyota" :
38
- if "rav4" in tokens :
39
- self .assertIn ("RAV4" , car .model , "Use correct capitalization" )
30
+ with self .subTest (car = car ):
31
+ tokens = car .model .lower ().split (" " )
32
+ if car .car_name == "hyundai" :
33
+ self .assertNotIn ("phev" , tokens , "Use `Plug-in Hybrid`" )
34
+ self .assertNotIn ("hev" , tokens , "Use `Hybrid`" )
35
+ self .assertNotIn ("ev" , tokens , "Use `Electric`" )
36
+ if "plug-in hybrid" in car .model .lower ():
37
+ self .assertIn ("Plug-in Hybrid" , car .model , "Use correct capitalization" )
38
+ elif car .car_name == "toyota" :
39
+ if "rav4" in tokens :
40
+ self .assertIn ("RAV4" , car .model , "Use correct capitalization" )
40
41
41
42
def test_torque_star (self ):
43
+ # Asserts brand-specific assumptions around steering torque star
42
44
for car in self .all_cars :
43
- if car .car_name == "honda" :
44
- self .assertTrue (car .row [Column .STEERING_TORQUE ] in (Star .EMPTY , Star .HALF ), f"{ car .name } has full torque star" )
45
+ with self .subTest (car = car ):
46
+ if car .car_name == "honda" :
47
+ self .assertIn (car .row [Column .STEERING_TORQUE ], (Star .EMPTY , Star .HALF ), f"{ car .name } has full torque star" )
48
+ elif car .car_name in ("toyota" , "hyundai" ):
49
+ self .assertNotEqual (car .row [Column .STEERING_TORQUE ], Star .EMPTY , f"{ car .name } has no torque star" )
45
50
46
51
47
52
if __name__ == "__main__" :
0 commit comments