New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve utility meter restore state tests #114356
Conversation
Hey there @dgomes, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
last_reset_1 = "2020-12-21T00:00:00.013073+00:00" | ||
last_reset_2 = "2020-12-22T00:00:00.013073+00:00" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use different timestamps so we know if the timestamp is restored from the UtilitySensorExtraStoredData
}, | ||
), | ||
{ | ||
"native_value": { | ||
"__type": "<class 'decimal.Decimal'>", | ||
"decimal_str": "3", | ||
"decimal_str": "1.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use different value so we know if the value is restored from the UtilitySensorExtraStoredData
ATTR_LAST_RESET: last_reset, | ||
ATTR_UNIT_OF_MEASUREMENT: UnitOfEnergy.KILO_WATT_HOUR, | ||
ATTR_LAST_RESET: last_reset_1, | ||
ATTR_UNIT_OF_MEASUREMENT: UnitOfEnergy.MEGA_WATT_HOUR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use different unit so we know if the unit is restored from the UtilitySensorExtraStoredData
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good
Proposed change
Improve utility meter restore state tests to make sure the test can detect if the state is restored as expected or not, also fix an error introduced by #88446
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: