Improve type hints in dsmr tests (#120393)
parent
fccb7ea1f9
commit
cbb3d48bd9
|
@ -15,10 +15,11 @@ from dsmr_parser.obis_references import (
|
||||||
)
|
)
|
||||||
from dsmr_parser.objects import CosemObject
|
from dsmr_parser.objects import CosemObject
|
||||||
import pytest
|
import pytest
|
||||||
|
from typing_extensions import Generator
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
async def dsmr_connection_fixture(hass):
|
def dsmr_connection_fixture() -> Generator[tuple[MagicMock, MagicMock, MagicMock]]:
|
||||||
"""Fixture that mocks serial connection."""
|
"""Fixture that mocks serial connection."""
|
||||||
|
|
||||||
transport = MagicMock(spec=asyncio.Transport)
|
transport = MagicMock(spec=asyncio.Transport)
|
||||||
|
@ -44,7 +45,9 @@ async def dsmr_connection_fixture(hass):
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
async def rfxtrx_dsmr_connection_fixture(hass):
|
def rfxtrx_dsmr_connection_fixture() -> (
|
||||||
|
Generator[tuple[MagicMock, MagicMock, MagicMock]]
|
||||||
|
):
|
||||||
"""Fixture that mocks RFXtrx connection."""
|
"""Fixture that mocks RFXtrx connection."""
|
||||||
|
|
||||||
transport = MagicMock(spec=asyncio.Transport)
|
transport = MagicMock(spec=asyncio.Transport)
|
||||||
|
@ -70,7 +73,9 @@ async def rfxtrx_dsmr_connection_fixture(hass):
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
async def dsmr_connection_send_validate_fixture(hass):
|
def dsmr_connection_send_validate_fixture() -> (
|
||||||
|
Generator[tuple[MagicMock, MagicMock, MagicMock]]
|
||||||
|
):
|
||||||
"""Fixture that mocks serial connection."""
|
"""Fixture that mocks serial connection."""
|
||||||
|
|
||||||
transport = MagicMock(spec=asyncio.Transport)
|
transport = MagicMock(spec=asyncio.Transport)
|
||||||
|
@ -151,7 +156,9 @@ async def dsmr_connection_send_validate_fixture(hass):
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
async def rfxtrx_dsmr_connection_send_validate_fixture(hass):
|
def rfxtrx_dsmr_connection_send_validate_fixture() -> (
|
||||||
|
Generator[tuple[MagicMock, MagicMock, MagicMock]]
|
||||||
|
):
|
||||||
"""Fixture that mocks serial connection."""
|
"""Fixture that mocks serial connection."""
|
||||||
|
|
||||||
transport = MagicMock(spec=asyncio.Transport)
|
transport = MagicMock(spec=asyncio.Transport)
|
||||||
|
|
|
@ -32,7 +32,8 @@ def com_port():
|
||||||
|
|
||||||
|
|
||||||
async def test_setup_network(
|
async def test_setup_network(
|
||||||
hass: HomeAssistant, dsmr_connection_send_validate_fixture
|
hass: HomeAssistant,
|
||||||
|
dsmr_connection_send_validate_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test we can setup network."""
|
"""Test we can setup network."""
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
|
@ -77,8 +78,10 @@ async def test_setup_network(
|
||||||
|
|
||||||
async def test_setup_network_rfxtrx(
|
async def test_setup_network_rfxtrx(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
dsmr_connection_send_validate_fixture,
|
dsmr_connection_send_validate_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||||
rfxtrx_dsmr_connection_send_validate_fixture,
|
rfxtrx_dsmr_connection_send_validate_fixture: tuple[
|
||||||
|
MagicMock, MagicMock, MagicMock
|
||||||
|
],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test we can setup network."""
|
"""Test we can setup network."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
||||||
|
@ -185,7 +188,7 @@ async def test_setup_network_rfxtrx(
|
||||||
async def test_setup_serial(
|
async def test_setup_serial(
|
||||||
com_mock,
|
com_mock,
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
dsmr_connection_send_validate_fixture,
|
dsmr_connection_send_validate_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||||
version: str,
|
version: str,
|
||||||
entry_data: dict[str, Any],
|
entry_data: dict[str, Any],
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -225,8 +228,10 @@ async def test_setup_serial(
|
||||||
async def test_setup_serial_rfxtrx(
|
async def test_setup_serial_rfxtrx(
|
||||||
com_mock,
|
com_mock,
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
dsmr_connection_send_validate_fixture,
|
dsmr_connection_send_validate_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||||
rfxtrx_dsmr_connection_send_validate_fixture,
|
rfxtrx_dsmr_connection_send_validate_fixture: tuple[
|
||||||
|
MagicMock, MagicMock, MagicMock
|
||||||
|
],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test we can setup serial."""
|
"""Test we can setup serial."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
||||||
|
@ -273,7 +278,9 @@ async def test_setup_serial_rfxtrx(
|
||||||
|
|
||||||
@patch("serial.tools.list_ports.comports", return_value=[com_port()])
|
@patch("serial.tools.list_ports.comports", return_value=[com_port()])
|
||||||
async def test_setup_serial_manual(
|
async def test_setup_serial_manual(
|
||||||
com_mock, hass: HomeAssistant, dsmr_connection_send_validate_fixture
|
com_mock,
|
||||||
|
hass: HomeAssistant,
|
||||||
|
dsmr_connection_send_validate_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test we can setup serial with manual entry."""
|
"""Test we can setup serial with manual entry."""
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
|
@ -321,7 +328,9 @@ async def test_setup_serial_manual(
|
||||||
|
|
||||||
@patch("serial.tools.list_ports.comports", return_value=[com_port()])
|
@patch("serial.tools.list_ports.comports", return_value=[com_port()])
|
||||||
async def test_setup_serial_fail(
|
async def test_setup_serial_fail(
|
||||||
com_mock, hass: HomeAssistant, dsmr_connection_send_validate_fixture
|
com_mock,
|
||||||
|
hass: HomeAssistant,
|
||||||
|
dsmr_connection_send_validate_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test failed serial connection."""
|
"""Test failed serial connection."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
||||||
|
@ -369,8 +378,10 @@ async def test_setup_serial_fail(
|
||||||
async def test_setup_serial_timeout(
|
async def test_setup_serial_timeout(
|
||||||
com_mock,
|
com_mock,
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
dsmr_connection_send_validate_fixture,
|
dsmr_connection_send_validate_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||||
rfxtrx_dsmr_connection_send_validate_fixture,
|
rfxtrx_dsmr_connection_send_validate_fixture: tuple[
|
||||||
|
MagicMock, MagicMock, MagicMock
|
||||||
|
],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test failed serial connection."""
|
"""Test failed serial connection."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
||||||
|
@ -425,8 +436,10 @@ async def test_setup_serial_timeout(
|
||||||
async def test_setup_serial_wrong_telegram(
|
async def test_setup_serial_wrong_telegram(
|
||||||
com_mock,
|
com_mock,
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
dsmr_connection_send_validate_fixture,
|
dsmr_connection_send_validate_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||||
rfxtrx_dsmr_connection_send_validate_fixture,
|
rfxtrx_dsmr_connection_send_validate_fixture: tuple[
|
||||||
|
MagicMock, MagicMock, MagicMock
|
||||||
|
],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test failed telegram data."""
|
"""Test failed telegram data."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
from dsmr_parser.obis_references import (
|
from dsmr_parser.obis_references import (
|
||||||
BELGIUM_MBUS1_DEVICE_TYPE,
|
BELGIUM_MBUS1_DEVICE_TYPE,
|
||||||
|
@ -22,7 +23,7 @@ async def test_migrate_gas_to_mbus(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
dsmr_connection_fixture,
|
dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test migration of unique_id."""
|
"""Test migration of unique_id."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
@ -113,7 +114,7 @@ async def test_migrate_gas_to_mbus_exists(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
dsmr_connection_fixture,
|
dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test migration of unique_id."""
|
"""Test migration of unique_id."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
|
|
@ -63,7 +63,9 @@ from tests.common import MockConfigEntry, patch
|
||||||
|
|
||||||
|
|
||||||
async def test_default_setup(
|
async def test_default_setup(
|
||||||
hass: HomeAssistant, entity_registry: er.EntityRegistry, dsmr_connection_fixture
|
hass: HomeAssistant,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the default setup."""
|
"""Test the default setup."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
@ -191,7 +193,9 @@ async def test_default_setup(
|
||||||
|
|
||||||
|
|
||||||
async def test_setup_only_energy(
|
async def test_setup_only_energy(
|
||||||
hass: HomeAssistant, entity_registry: er.EntityRegistry, dsmr_connection_fixture
|
hass: HomeAssistant,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the default setup."""
|
"""Test the default setup."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
@ -240,7 +244,9 @@ async def test_setup_only_energy(
|
||||||
assert not entry
|
assert not entry
|
||||||
|
|
||||||
|
|
||||||
async def test_v4_meter(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
async def test_v4_meter(
|
||||||
|
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||||
|
) -> None:
|
||||||
"""Test if v4 meter is correctly parsed."""
|
"""Test if v4 meter is correctly parsed."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
|
||||||
|
@ -319,7 +325,10 @@ async def test_v4_meter(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_v5_meter(
|
async def test_v5_meter(
|
||||||
hass: HomeAssistant, dsmr_connection_fixture, value: Decimal, state: str
|
hass: HomeAssistant,
|
||||||
|
dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||||
|
value: Decimal,
|
||||||
|
state: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test if v5 meter is correctly parsed."""
|
"""Test if v5 meter is correctly parsed."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
@ -386,7 +395,9 @@ async def test_v5_meter(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_luxembourg_meter(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
async def test_luxembourg_meter(
|
||||||
|
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||||
|
) -> None:
|
||||||
"""Test if v5 meter is correctly parsed."""
|
"""Test if v5 meter is correctly parsed."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
|
||||||
|
@ -468,7 +479,9 @@ async def test_luxembourg_meter(hass: HomeAssistant, dsmr_connection_fixture) ->
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_belgian_meter(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
async def test_belgian_meter(
|
||||||
|
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||||
|
) -> None:
|
||||||
"""Test if Belgian meter is correctly parsed."""
|
"""Test if Belgian meter is correctly parsed."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
|
||||||
|
@ -651,7 +664,9 @@ async def test_belgian_meter(hass: HomeAssistant, dsmr_connection_fixture) -> No
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_belgian_meter_alt(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
async def test_belgian_meter_alt(
|
||||||
|
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||||
|
) -> None:
|
||||||
"""Test if Belgian meter is correctly parsed."""
|
"""Test if Belgian meter is correctly parsed."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
|
||||||
|
@ -798,7 +813,9 @@ async def test_belgian_meter_alt(hass: HomeAssistant, dsmr_connection_fixture) -
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_belgian_meter_mbus(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
async def test_belgian_meter_mbus(
|
||||||
|
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||||
|
) -> None:
|
||||||
"""Test if Belgian meter is correctly parsed."""
|
"""Test if Belgian meter is correctly parsed."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
|
||||||
|
@ -905,7 +922,9 @@ async def test_belgian_meter_mbus(hass: HomeAssistant, dsmr_connection_fixture)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_belgian_meter_low(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
async def test_belgian_meter_low(
|
||||||
|
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||||
|
) -> None:
|
||||||
"""Test if Belgian meter is correctly parsed."""
|
"""Test if Belgian meter is correctly parsed."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
|
||||||
|
@ -951,7 +970,9 @@ async def test_belgian_meter_low(hass: HomeAssistant, dsmr_connection_fixture) -
|
||||||
assert active_tariff.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
assert active_tariff.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
||||||
|
|
||||||
|
|
||||||
async def test_swedish_meter(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
async def test_swedish_meter(
|
||||||
|
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||||
|
) -> None:
|
||||||
"""Test if v5 meter is correctly parsed."""
|
"""Test if v5 meter is correctly parsed."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
|
||||||
|
@ -1017,7 +1038,9 @@ async def test_swedish_meter(hass: HomeAssistant, dsmr_connection_fixture) -> No
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_easymeter(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
async def test_easymeter(
|
||||||
|
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||||
|
) -> None:
|
||||||
"""Test if Q3D meter is correctly parsed."""
|
"""Test if Q3D meter is correctly parsed."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
|
||||||
|
@ -1086,7 +1109,9 @@ async def test_easymeter(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_tcp(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
async def test_tcp(
|
||||||
|
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||||
|
) -> None:
|
||||||
"""If proper config provided TCP connection should be made."""
|
"""If proper config provided TCP connection should be made."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
|
||||||
|
@ -1112,7 +1137,10 @@ async def test_tcp(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
||||||
assert connection_factory.call_args_list[0][0][1] == "1234"
|
assert connection_factory.call_args_list[0][0][1] == "1234"
|
||||||
|
|
||||||
|
|
||||||
async def test_rfxtrx_tcp(hass: HomeAssistant, rfxtrx_dsmr_connection_fixture) -> None:
|
async def test_rfxtrx_tcp(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
rfxtrx_dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||||
|
) -> None:
|
||||||
"""If proper config provided RFXtrx TCP connection should be made."""
|
"""If proper config provided RFXtrx TCP connection should be made."""
|
||||||
(connection_factory, transport, protocol) = rfxtrx_dsmr_connection_fixture
|
(connection_factory, transport, protocol) = rfxtrx_dsmr_connection_fixture
|
||||||
|
|
||||||
|
@ -1140,7 +1168,7 @@ async def test_rfxtrx_tcp(hass: HomeAssistant, rfxtrx_dsmr_connection_fixture) -
|
||||||
|
|
||||||
@patch("homeassistant.components.dsmr.sensor.DEFAULT_RECONNECT_INTERVAL", 0)
|
@patch("homeassistant.components.dsmr.sensor.DEFAULT_RECONNECT_INTERVAL", 0)
|
||||||
async def test_connection_errors_retry(
|
async def test_connection_errors_retry(
|
||||||
hass: HomeAssistant, dsmr_connection_fixture
|
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Connection should be retried on error during setup."""
|
"""Connection should be retried on error during setup."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
@ -1177,7 +1205,9 @@ async def test_connection_errors_retry(
|
||||||
|
|
||||||
|
|
||||||
@patch("homeassistant.components.dsmr.sensor.DEFAULT_RECONNECT_INTERVAL", 0)
|
@patch("homeassistant.components.dsmr.sensor.DEFAULT_RECONNECT_INTERVAL", 0)
|
||||||
async def test_reconnect(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
async def test_reconnect(
|
||||||
|
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||||
|
) -> None:
|
||||||
"""If transport disconnects, the connection should be retried."""
|
"""If transport disconnects, the connection should be retried."""
|
||||||
|
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
@ -1255,7 +1285,7 @@ async def test_reconnect(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
||||||
|
|
||||||
|
|
||||||
async def test_gas_meter_providing_energy_reading(
|
async def test_gas_meter_providing_energy_reading(
|
||||||
hass: HomeAssistant, dsmr_connection_fixture
|
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that gas providing energy readings use the correct device class."""
|
"""Test that gas providing energy readings use the correct device class."""
|
||||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||||
|
|
Loading…
Reference in New Issue