Skip to content

Commit fffdac9

Browse files
sshanespektor56
authored andcommitted
compatibility docs: fixup steering torque star (commaai#24940)
* Ascent has good torque, hard code Toyota, print all unexpected torque star cars * update docs * Use subtests * hardcode CHR for now generate * Hard code Impreza * update refs
1 parent d554d87 commit fffdac9

File tree

6 files changed

+41
-35
lines changed

6 files changed

+41
-35
lines changed

docs/CARS.md

+16-16
Large diffs are not rendered by default.

selfdrive/car/subaru/values.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class SubaruCarInfo(CarInfo):
4141

4242

4343
CAR_INFO: Dict[str, Union[SubaruCarInfo, List[SubaruCarInfo]]] = {
44-
CAR.ASCENT: SubaruCarInfo("Subaru Ascent 2019-20", "All"),
44+
CAR.ASCENT: SubaruCarInfo("Subaru Ascent 2019-20", "All", good_torque=True),
4545
CAR.IMPREZA: [
4646
SubaruCarInfo("Subaru Impreza 2017-19"),
4747
SubaruCarInfo("Subaru Crosstrek 2018-19", video_link="https://youtu.be/Agww7oE1k-s?t=26"),

selfdrive/car/tests/test_docs.py

+21-16
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,37 @@ def test_generator(self):
1616
current_cars_md = f.read()
1717

1818
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")
2020

2121
def test_missing_car_info(self):
2222
all_car_info_platforms = get_interface_attr("CAR_INFO", combine_brands=True).keys()
2323
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))
2626

2727
def test_naming_conventions(self):
28-
# Asserts market-standard car naming conventions by make
28+
# Asserts market-standard car naming conventions by brand
2929
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")
4041

4142
def test_torque_star(self):
43+
# Asserts brand-specific assumptions around steering torque star
4244
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")
4550

4651

4752
if __name__ == "__main__":

0 commit comments

Comments
 (0)