Skip to content

Commit e4f8356

Browse files
committed
Fix MockResampler to treat nan as None
The real resampler treats any input `nan` value as `None`, so the mock resampler should do the same. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent ba544b5 commit e4f8356

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/timeseries/mock_resampler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def make_sample(self, value: float | None) -> Sample[Quantity]:
192192
"""Create a sample with the given value."""
193193
return Sample(
194194
self._next_ts,
195-
None if value is None else Quantity(value),
195+
None if value is None or math.isnan(value) else Quantity(value),
196196
)
197197

198198
async def send_meter_power(self, values: list[float | None]) -> None:

0 commit comments

Comments
 (0)