Use is in ConfigEntryState enum comparison in tests (A-M) (#114925)

This commit is contained in:
epenet 2024-04-05 17:16:55 +02:00 committed by GitHub
parent dd8de14cc5
commit 0b01326f9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
99 changed files with 302 additions and 295 deletions

View file

@ -20,12 +20,12 @@ from .conftest import MockPchkConnectionManager, setup_component
async def test_async_setup_entry(hass: HomeAssistant, entry, lcn_connection) -> None:
"""Test a successful setup entry and unload of entry."""
assert len(hass.config_entries.async_entries(DOMAIN)) == 1
assert entry.state == ConfigEntryState.LOADED
assert entry.state is ConfigEntryState.LOADED
assert await hass.config_entries.async_unload(entry.entry_id)
await hass.async_block_till_done()
assert entry.state == ConfigEntryState.NOT_LOADED
assert entry.state is ConfigEntryState.NOT_LOADED
assert not hass.data.get(DOMAIN)
@ -36,7 +36,7 @@ async def test_async_setup_multiple_entries(hass: HomeAssistant, entry, entry2)
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
assert config_entry.state == ConfigEntryState.LOADED
assert config_entry.state is ConfigEntryState.LOADED
assert len(hass.config_entries.async_entries(DOMAIN)) == 2
@ -44,7 +44,7 @@ async def test_async_setup_multiple_entries(hass: HomeAssistant, entry, entry2)
assert await hass.config_entries.async_unload(config_entry.entry_id)
await hass.async_block_till_done()
assert config_entry.state == ConfigEntryState.NOT_LOADED
assert config_entry.state is ConfigEntryState.NOT_LOADED
assert not hass.data.get(DOMAIN)
@ -96,7 +96,7 @@ async def test_async_setup_entry_raises_authentication_error(
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
assert entry.state == ConfigEntryState.SETUP_ERROR
assert entry.state is ConfigEntryState.SETUP_ERROR
async def test_async_setup_entry_raises_license_error(
@ -110,7 +110,7 @@ async def test_async_setup_entry_raises_license_error(
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
assert entry.state == ConfigEntryState.SETUP_ERROR
assert entry.state is ConfigEntryState.SETUP_ERROR
async def test_async_setup_entry_raises_timeout_error(
@ -122,7 +122,7 @@ async def test_async_setup_entry_raises_timeout_error(
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
assert entry.state == ConfigEntryState.SETUP_ERROR
assert entry.state is ConfigEntryState.SETUP_ERROR
async def test_async_setup_from_configuration_yaml(hass: HomeAssistant) -> None: