mirror of
https://github.com/home-assistant/core.git
synced 2025-11-12 20:40:18 +00:00
Use python defaults for comparing State, LazyState, and Event objects (#86856)
* Speed up comparing State and Event objects Use default python implementation for State and Event __hash__ and __eq__ The default implementation compared based on the id() of the object which is effectively what we want here anyways. These overrides are left over from the days when these used to be attrs objects By avoiding implementing these ourselves all of the equality checks can happen in native code * tweak * adjust tests * write out some more * fix test to not compare objects * more test fixes * more test fixes * correct stats tests * fix more tests * fix more tests * update sensor recorder tests
This commit is contained in:
@@ -30,8 +30,9 @@ async def test_api_list_state_entities(hass, mock_api_client):
|
||||
assert resp.status == HTTPStatus.OK
|
||||
json = await resp.json()
|
||||
|
||||
remote_data = [ha.State.from_dict(item) for item in json]
|
||||
assert remote_data == hass.states.async_all()
|
||||
remote_data = [ha.State.from_dict(item).as_dict() for item in json]
|
||||
local_data = [state.as_dict() for state in hass.states.async_all()]
|
||||
assert remote_data == local_data
|
||||
|
||||
|
||||
async def test_api_get_state(hass, mock_api_client):
|
||||
|
||||
Reference in New Issue
Block a user