Skip to content

Commit

Permalink
mypy tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdavb committed Sep 1, 2024
1 parent d320c47 commit 9bc985e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/evohomeasync2/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def __init__(self, gateway: Gateway, config: _EvoDictT, /) -> None:
self._status: _EvoDictT = {}

self.zones: list[Zone] = []
self.zone_by_id: dict[str, Zone] = {}
self.zone_by_id: dict[str, Zone | HotWater] = {}
self.hotwater: None | HotWater = None

zon_config: _EvoDictT
Expand Down
10 changes: 2 additions & 8 deletions tests/tests_rf/test_v2_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from __future__ import annotations

from datetime import datetime as dt
from typing import TYPE_CHECKING

import pytest

Expand All @@ -26,9 +25,6 @@
from .const import ExitTestReason
from .helpers import instantiate_client_v2

if TYPE_CHECKING:
from evohomeasync2.zone import Zone

#######################################################################################


Expand Down Expand Up @@ -115,16 +111,14 @@ async def _test_sched__apis(evo: evo2.EvohomeClient) -> None:
assert SCH_PUT_SCHEDULE_DHW(schedule)
await dhw.set_schedule(schedule)

zone: Zone | None

if (zone := evo.default_system().zones[0]) and zone._id != faked.GHOST_ZONE_ID:
schedule = await zone.get_schedule()
assert SCH_PUT_SCHEDULE_ZONE(schedule)
await zone.set_schedule(schedule)

if zone := evo.default_system().zone_by_id.get(faked.GHOST_ZONE_ID):
if child := evo.default_system().zone_by_id.get(faked.GHOST_ZONE_ID):
try:
schedule = await zone.get_schedule()
schedule = await child.get_schedule()
except evo2.InvalidScheduleError:
pass
else:
Expand Down

0 comments on commit 9bc985e

Please sign in to comment.