From 8cc23d7743b867eb18dac568ede297ee15470044 Mon Sep 17 00:00:00 2001 From: firstmate crewmate Date: Mon, 3 Aug 2026 21:05:14 +1000 Subject: [PATCH] feat(vehicle): add Cybercab (VIN 4th-char A) to model detection Adds the A -> Cybercab mapping to MODELS in vehicle.py, matching the existing S/X/3/Y/C/R/T entries; no other model-derivation site found in the repo. --- tesla_fleet_api.egg-info/SOURCES.txt | 3 +- tesla_fleet_api/tesla/vehicle/vehicle.py | 1 + tests/test_vehicle_model.py | 39 ++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 tests/test_vehicle_model.py diff --git a/tesla_fleet_api.egg-info/SOURCES.txt b/tesla_fleet_api.egg-info/SOURCES.txt index 9f37869..cc10ab6 100644 --- a/tesla_fleet_api.egg-info/SOURCES.txt +++ b/tesla_fleet_api.egg-info/SOURCES.txt @@ -99,4 +99,5 @@ tests/test_teslemetry_authorized_clients.py tests/test_teslemetry_gateway_address.py tests/test_teslemetry_wait_until_paired.py tests/test_tessie_vehicle_params.py -tests/test_vehicle_image_state.py \ No newline at end of file +tests/test_vehicle_image_state.py +tests/test_vehicle_model.py \ No newline at end of file diff --git a/tesla_fleet_api/tesla/vehicle/vehicle.py b/tesla_fleet_api/tesla/vehicle/vehicle.py index 4a59d13..0e82a1a 100644 --- a/tesla_fleet_api/tesla/vehicle/vehicle.py +++ b/tesla_fleet_api/tesla/vehicle/vehicle.py @@ -15,6 +15,7 @@ "C": "Cybertruck", "R": "Roadster", "T": "Semi", + "A": "Cybercab", } diff --git a/tests/test_vehicle_model.py b/tests/test_vehicle_model.py new file mode 100644 index 0000000..d84fbc0 --- /dev/null +++ b/tests/test_vehicle_model.py @@ -0,0 +1,39 @@ +"""Model detection from the VIN's 4th character (Vehicle.model).""" + +from unittest import TestCase + +from tesla_fleet_api.tesla.vehicle.vehicle import Vehicle + + +class VehicleModelTests(TestCase): + def _model_for(self, fourth_char: str) -> str: + vin = f"5YJ{fourth_char}CAE43LF123456" + vehicle = Vehicle(parent=None, vin=vin) + return vehicle.model + + def test_model_s(self): + self.assertEqual(self._model_for("S"), "Model S") + + def test_model_x(self): + self.assertEqual(self._model_for("X"), "Model X") + + def test_model_3(self): + self.assertEqual(self._model_for("3"), "Model 3") + + def test_model_y(self): + self.assertEqual(self._model_for("Y"), "Model Y") + + def test_cybertruck(self): + self.assertEqual(self._model_for("C"), "Cybertruck") + + def test_roadster(self): + self.assertEqual(self._model_for("R"), "Roadster") + + def test_semi(self): + self.assertEqual(self._model_for("T"), "Semi") + + def test_cybercab(self): + self.assertEqual(self._model_for("A"), "Cybercab") + + def test_unknown(self): + self.assertEqual(self._model_for("Z"), "Unknown")