-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also, refactor to use fixtures to setup tests.
- Loading branch information
Showing
4 changed files
with
311 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ pre-commit==3.7.1 | |
pytest==8.2.0 | ||
pytest-cov==5.0.0 | ||
pytest-homeassistant-custom-component==0.13.135 | ||
syrupy==4.6.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
# serializer version: 1 | ||
# name: test_most_recent_day_sensor | ||
StateSnapshot({ | ||
'attributes': ReadOnlyDict({ | ||
'attribution': 'Data scraped from WaterSmart', | ||
'device_class': 'water', | ||
'friendly_name': 'WaterSmart (test) Gallons for most recent full day', | ||
'related': list([ | ||
dict({ | ||
'gallons': 1, | ||
'start': '2024-06-20T00:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 2, | ||
'start': '2024-06-20T01:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 3, | ||
'start': '2024-06-20T02:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 4, | ||
'start': '2024-06-20T03:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 5, | ||
'start': '2024-06-20T04:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 6, | ||
'start': '2024-06-20T05:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 7, | ||
'start': '2024-06-20T06:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 8, | ||
'start': '2024-06-20T07:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 9, | ||
'start': '2024-06-20T08:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 10, | ||
'start': '2024-06-20T09:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 11, | ||
'start': '2024-06-20T10:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 12, | ||
'start': '2024-06-20T11:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 13, | ||
'start': '2024-06-20T12:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 14, | ||
'start': '2024-06-20T13:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 15, | ||
'start': '2024-06-20T14:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 16, | ||
'start': '2024-06-20T15:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 17, | ||
'start': '2024-06-20T16:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 18, | ||
'start': '2024-06-20T17:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 19, | ||
'start': '2024-06-20T18:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 20, | ||
'start': '2024-06-20T19:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 21, | ||
'start': '2024-06-20T20:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 22, | ||
'start': '2024-06-20T21:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 23, | ||
'start': '2024-06-20T22:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 24, | ||
'start': '2024-06-20T23:00:00-07:00', | ||
}), | ||
]), | ||
'unit_of_measurement': <UnitOfVolume.LITERS: 'L'>, | ||
}), | ||
'context': <ANY>, | ||
'entity_id': 'sensor.watersmart_test_gallons_for_most_recent_full_day', | ||
'last_changed': <ANY>, | ||
'last_reported': <ANY>, | ||
'last_updated': <ANY>, | ||
'state': '1136', | ||
}) | ||
# --- | ||
# name: test_most_recent_hour_sensor | ||
StateSnapshot({ | ||
'attributes': ReadOnlyDict({ | ||
'attribution': 'Data scraped from WaterSmart', | ||
'device_class': 'water', | ||
'friendly_name': 'WaterSmart (test) Gallons for most recent hour', | ||
'related': list([ | ||
dict({ | ||
'gallons': 7.48, | ||
'start': '2024-06-19T19:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 0, | ||
'start': '2024-06-19T20:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 7.48, | ||
'start': '2024-06-19T21:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 14.3, | ||
'start': '2024-06-19T22:00:00-07:00', | ||
}), | ||
]), | ||
'start': '2024-06-19T22:00:00-07:00', | ||
'unit_of_measurement': <UnitOfVolume.LITERS: 'L'>, | ||
}), | ||
'context': <ANY>, | ||
'entity_id': 'sensor.watersmart_test_gallons_for_most_recent_hour', | ||
'last_changed': <ANY>, | ||
'last_reported': <ANY>, | ||
'last_updated': <ANY>, | ||
'state': '54.1', | ||
}) | ||
# --- | ||
# name: test_sensors_for_zero_gallons | ||
StateSnapshot({ | ||
'attributes': ReadOnlyDict({ | ||
'attribution': 'Data scraped from WaterSmart', | ||
'device_class': 'water', | ||
'friendly_name': 'WaterSmart (test) Gallons for most recent full day', | ||
'related': list([ | ||
]), | ||
'unit_of_measurement': <UnitOfVolume.LITERS: 'L'>, | ||
}), | ||
'context': <ANY>, | ||
'entity_id': 'sensor.watersmart_test_gallons_for_most_recent_full_day', | ||
'last_changed': <ANY>, | ||
'last_reported': <ANY>, | ||
'last_updated': <ANY>, | ||
'state': '0', | ||
}) | ||
# --- | ||
# name: test_sensors_for_zero_gallons.1 | ||
StateSnapshot({ | ||
'attributes': ReadOnlyDict({ | ||
'attribution': 'Data scraped from WaterSmart', | ||
'device_class': 'water', | ||
'friendly_name': 'WaterSmart (test) Gallons for most recent hour', | ||
'related': list([ | ||
dict({ | ||
'gallons': 7.48, | ||
'start': '2024-06-19T19:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 0, | ||
'start': '2024-06-19T20:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 7.48, | ||
'start': '2024-06-19T21:00:00-07:00', | ||
}), | ||
dict({ | ||
'gallons': 0, | ||
'start': '2024-06-19T22:00:00-07:00', | ||
}), | ||
]), | ||
'start': '2024-06-19T22:00:00-07:00', | ||
'unit_of_measurement': <UnitOfVolume.LITERS: 'L'>, | ||
}), | ||
'context': <ANY>, | ||
'entity_id': 'sensor.watersmart_test_gallons_for_most_recent_hour', | ||
'last_changed': <ANY>, | ||
'last_reported': <ANY>, | ||
'last_updated': <ANY>, | ||
'state': '0', | ||
}) | ||
# --- |
Oops, something went wrong.