Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion teslemetry_stream/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,17 @@ def upper_options(self) -> list[str]:

CarType = TeslemetryEnum(
"CarType",
["Unknown", "ModelS", "ModelX", "Model3", "ModelY", "SemiTruck", "Cybertruck"],
[
"Unknown",
"ModelS",
"ModelX",
"Model3",
"ModelY",
"SemiTruck",
"Cybertruck",
"SemiTruckV2",
"Cybercab",
],
)

ChargePort = TeslemetryEnum("ChargePort", ["Unknown", "US", "EU", "GB", "CCS"])
Expand Down
8 changes: 5 additions & 3 deletions tests/test_enum_tables.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Pin TeslemetryEnum value tables in const.py against tesla-protocol 1.4.0.
"""Pin TeslemetryEnum value tables in const.py against tesla-protocol 3.0.1.

These tables are hand-maintained, not derived at runtime (see AGENTS.md for
why), so this test is the thing that would catch drift against the proto
Expand All @@ -9,7 +9,7 @@
from teslemetry_stream import const

# name -> expected TeslemetryEnum.values, verified byte-for-byte against
# tesla_protocol.telemetry.vehicle_data_pb2's enum descriptors (1.4.0).
# tesla_protocol.telemetry.vehicle_data_pb2's enum descriptors (3.0.1).
EXPECTED: dict[str, list[str]] = {
"DetailedChargeState": [
"DetailedChargeStateUnknown",
Expand Down Expand Up @@ -51,6 +51,8 @@
"CarTypeModelY",
"CarTypeSemiTruck",
"CarTypeCybertruck",
"CarTypeSemiTruckV2",
"CarTypeCybercab",
],
}

Expand All @@ -66,7 +68,7 @@ def main() -> None:
table = getattr(const, name)
results.append(
check(
f"{name}.values matches tesla-protocol 1.4.0",
f"{name}.values matches tesla-protocol 3.0.1",
table.values == expected,
f"got {table.values}",
)
Expand Down
Loading