19 lines
818 B
Python
19 lines
818 B
Python
from idea78_solarsphere_offline_first.core import Asset, TelemetryPoint, WeatherLayer, Event
|
|
|
|
|
|
def test_asset_dataclass():
|
|
a = Asset(site_id="site-01", location={"lat": 12.34, "lon": 56.78}, layers=["terrain", "overlay"], version=1)
|
|
assert a.site_id == "site-01"
|
|
assert isinstance(a.layers, list) and a.layers[0] == "terrain"
|
|
|
|
|
|
def test_telemetry_point_dataclass():
|
|
t = TelemetryPoint(site_id="site-01", ts=1234567890, lat=12.3, lon=45.6, metric="temp", value=22.5)
|
|
assert t.metric == "temp" and t.value == 22.5
|
|
|
|
|
|
def test_weather_event_dataclass():
|
|
w = WeatherLayer(region="region-1", ts=1000, param="wind", value=5.4, source="sim")
|
|
e = Event(ts=1000, site_id="site-01", type="maintenance", description="routine check", severity="low")
|
|
assert w.param == "wind" and e.severity == "low"
|