From d51982f12fe7bc66896e6fcd35106ccf09ed3a9f Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 12 Jun 2023 21:48:12 +0200 Subject: [PATCH] Add missing assert to test_async_remove_ignores_in_flight_polling (#94487) --- tests/helpers/test_entity.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/helpers/test_entity.py b/tests/helpers/test_entity.py index 3ea820e684c..f1133e30483 100644 --- a/tests/helpers/test_entity.py +++ b/tests/helpers/test_entity.py @@ -602,10 +602,16 @@ async def test_async_remove_ignores_in_flight_polling(hass: HomeAssistant) -> No ent.async_on_remove(lambda: result.append(1)) await platform.async_add_entities([ent]) assert hass.states.get("test.test").state == STATE_UNKNOWN + + # Remove the entity from the entity registry await ent.async_remove() assert len(result) == 1 assert hass.states.get("test.test") is None + + # Simulate an in-flight poll after the entity was removed ent.async_write_ha_state() + assert len(result) == 1 + assert hass.states.get("test.test") is None async def test_set_context(hass: HomeAssistant) -> None: