Replace assert_lists_same with pytest_unordered in integrations h-m (#94901)

This commit is contained in:
Erik Montnemery 2023-06-20 20:16:25 +02:00 committed by GitHub
parent c4d7695173
commit fd822bce56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 61 additions and 59 deletions

View file

@ -3,6 +3,7 @@ import json
from unittest.mock import patch
import pytest
from pytest_unordered import unordered
import homeassistant.components.automation as automation
from homeassistant.components.device_automation import DeviceAutomationType
@ -17,7 +18,6 @@ from homeassistant.setup import async_setup_component
from .test_common import help_test_unload_config_entry
from tests.common import (
assert_lists_same,
async_fire_mqtt_message,
async_get_device_automations,
async_mock_service,
@ -79,7 +79,7 @@ async def test_get_triggers(
triggers = await async_get_device_automations(
hass, DeviceAutomationType.TRIGGER, device_entry.id
)
assert_lists_same(triggers, expected_triggers)
assert triggers == unordered(expected_triggers)
async def test_get_unknown_triggers(
@ -126,7 +126,7 @@ async def test_get_unknown_triggers(
triggers = await async_get_device_automations(
hass, DeviceAutomationType.TRIGGER, device_entry.id
)
assert_lists_same(triggers, [])
assert triggers == []
async def test_get_non_existing_triggers(
@ -149,7 +149,7 @@ async def test_get_non_existing_triggers(
triggers = await async_get_device_automations(
hass, DeviceAutomationType.TRIGGER, device_entry.id
)
assert_lists_same(triggers, [])
assert triggers == []
@pytest.mark.no_fail_on_log_exception
@ -200,7 +200,7 @@ async def test_discover_bad_triggers(
triggers = await async_get_device_automations(
hass, DeviceAutomationType.TRIGGER, device_entry.id
)
assert_lists_same(triggers, expected_triggers)
assert triggers == unordered(expected_triggers)
async def test_update_remove_triggers(
@ -253,7 +253,7 @@ async def test_update_remove_triggers(
triggers = await async_get_device_automations(
hass, DeviceAutomationType.TRIGGER, device_entry.id
)
assert_lists_same(triggers, expected_triggers1)
assert triggers == unordered(expected_triggers1)
# Update trigger
async_fire_mqtt_message(hass, "homeassistant/device_automation/bla/config", data2)
@ -262,7 +262,7 @@ async def test_update_remove_triggers(
triggers = await async_get_device_automations(
hass, DeviceAutomationType.TRIGGER, device_entry.id
)
assert_lists_same(triggers, expected_triggers2)
assert triggers == unordered(expected_triggers2)
# Remove trigger
async_fire_mqtt_message(hass, "homeassistant/device_automation/bla/config", "")