diff --git a/src/evohomeasync2/gateway.py b/src/evohomeasync2/gateway.py index 9843117..6cc4fed 100644 --- a/src/evohomeasync2/gateway.py +++ b/src/evohomeasync2/gateway.py @@ -3,8 +3,9 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Final +from typing import TYPE_CHECKING, Final, NoReturn +from . import exceptions as exc from .schema import SCH_GWY_STATUS from .schema.const import ( SZ_GATEWAY, @@ -25,7 +26,15 @@ from .schema import _EvoDictT -class Gateway(ActiveFaultsBase, EntityBase): +class _GatewayDeprecated: # pragma: no cover + """Deprecated attributes and methods removed from the evohome-client namespace.""" + + @property + def systemId(self) -> NoReturn: # noqa: N802 + raise exc.DeprecationError(f"{self}: .gatewayId is deprecated, use .id") + + +class Gateway(_GatewayDeprecated, ActiveFaultsBase, EntityBase): """Instance of a location's gateway.""" STATUS_SCHEMA: Final[vol.Schema] = SCH_GWY_STATUS diff --git a/src/evohomeasync2/hotwater.py b/src/evohomeasync2/hotwater.py index 2a8daaa..3361d51 100644 --- a/src/evohomeasync2/hotwater.py +++ b/src/evohomeasync2/hotwater.py @@ -37,10 +37,6 @@ class _HotWaterDeprecated: # pragma: no cover """Deprecated attributes and methods removed from the evohome-client namespace.""" - @property - def zoneId(self) -> NoReturn: # noqa: N802 - raise exc.DeprecationError(f"{self}: .zoneId is deprecated, use .id") - async def get_dhw_state(self, *args: Any, **kwargs: Any) -> NoReturn: raise exc.DeprecationError( f"{self}: .get_dhw_state() is deprecated, use Location.refresh_status()" diff --git a/src/evohomeasync2/location.py b/src/evohomeasync2/location.py index 01fd466..d9716d6 100644 --- a/src/evohomeasync2/location.py +++ b/src/evohomeasync2/location.py @@ -33,6 +33,10 @@ class _LocationDeprecated: # pragma: no cover """Deprecated attributes and methods removed from the evohome-client namespace.""" + @property + def locationId(self) -> NoReturn: # noqa: N802 + raise exc.DeprecationError(f"{self}: .locationId is deprecated, use .id") + async def status(self, *args: Any, **kwargs: Any) -> NoReturn: raise exc.DeprecationError( f"{self}: .status() is deprecated, use .refresh_status()" diff --git a/src/evohomeasync2/system.py b/src/evohomeasync2/system.py index 6402605..f110268 100644 --- a/src/evohomeasync2/system.py +++ b/src/evohomeasync2/system.py @@ -54,6 +54,10 @@ class _SystemDeprecated: # pragma: no cover """Deprecated attributes and methods removed from the evohome-client namespace.""" + @property + def systemId(self) -> NoReturn: # noqa: N802 + raise exc.DeprecationError(f"{self}: .systemId is deprecated, use .id") + async def set_status_reset(self, *args: Any, **kwargs: Any) -> NoReturn: raise exc.DeprecationError( f"{self}: .set_status_reset() is deprecrated, use .reset_mode()" diff --git a/src/evohomeasync2/zone.py b/src/evohomeasync2/zone.py index 5833787..737fedd 100644 --- a/src/evohomeasync2/zone.py +++ b/src/evohomeasync2/zone.py @@ -125,6 +125,10 @@ def log_as_resolved(fault: _EvoDictT) -> None: class _ZoneBaseDeprecated: # pragma: no cover """Deprecated attributes and methods removed from the evohome-client namespace.""" + @property + def zoneId(self) -> NoReturn: # noqa: N802 + raise exc.DeprecationError(f"{self}: .zoneId is deprecated, use .id") + async def schedule(self) -> NoReturn: raise exc.DeprecationError( f"{self}: .schedule() is deprecrated, use .get_schedule()" diff --git a/tests/tests/test_installs.py b/tests/tests/test_installs.py index 44b5548..376e4ad 100644 --- a/tests/tests/test_installs.py +++ b/tests/tests/test_installs.py @@ -18,6 +18,9 @@ from pytest_snapshot.plugin import Snapshot # type: ignore[import-untyped] +_DEPRECATED_ATTRS = ("locationId", "gatewayId", "systemId", "zoneId", "zone_type") + + def pytest_generate_tests(metafunc: pytest.Metafunc) -> None: folders = [ p.name @@ -36,7 +39,7 @@ def obj_to_dict(obj: object) -> dict[str, Any]: return { attr: getattr(obj, attr) for attr in get_property_methods(obj) - if attr not in ("zoneId", "zone_type") # excl. deprecated attrs + if attr not in _DEPRECATED_ATTRS } with patch("evohomeasync2.broker.Broker.get", broker_get(install)):