Advanced Enumerations (compatible with Python's stdlib Enum), NamedTuples, and NamedConstants
76
Design a tuple-backed data structure for telemetry readings with strict field control, alias-friendly accessors, and validation suitable for small device payloads.
(device_id, state, temp_c, humidity_percent) yields an object of length 4 whose iteration/unpacking returns those values in that order. @testid returns the same value as device_id, and status returns the same value as state; these aliases do not change the tuple length or order. @testdiagnostics attribute as a tuple in the order provided. @teststate is not "ok" or "alert", or when humidity_percent falls outside 0–100, before a reading is returned. @test@generates
class TelemetryReading(tuple):
device_id: str
id: str # alias for device_id
state: str
status: str # alias for state
temp_c: float
humidity_percent: float
diagnostics: tuple[str, ...]
def __new__(
cls,
device_id: str,
state: str,
temp_c: float,
humidity_percent: float,
*diagnostics: str,
) -> "TelemetryReading": ...Provides enhanced enum and tuple helpers used to enforce tuple sizing, aliases, ordering, and value review logic.
Install with Tessl CLI
npx tessl i tessl/pypi-aenumevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10