Skip to content

Commit cd4fa63

Browse files
authored
Type child lock method correctly (#107)
1 parent 34e5526 commit cd4fa63

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

src/tadoasync/tadoasync.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,8 @@ async def get_device_info(
376376
response = await self._request(f"devices/{serial_no}/")
377377
return Device.from_json(response)
378378

379-
async def set_child_lock(self, serial_no: str, child_lock: bool | None) -> None:
379+
async def set_child_lock(self, serial_no: str, *, child_lock: bool) -> None:
380380
"""Set the child lock."""
381-
if not isinstance(child_lock, bool):
382-
raise TadoBadRequestError("child_lock must be a boolean")
383-
384381
await self._request(
385382
f"devices/{serial_no}/childLock",
386383
data={"childLockEnabled": child_lock},

tests/test_tado.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -498,17 +498,6 @@ async def test_set_child_lock(python_tado: Tado, responses: aioresponses) -> Non
498498
)
499499
await python_tado.set_child_lock(serial_no=device_id, child_lock=child_lock)
500500

501-
invalid_child_lock = None
502-
responses.put(
503-
f"{TADO_API_URL}/devices/{device_id}/childLock",
504-
status=204,
505-
payload={"childLockEnabled": child_lock},
506-
)
507-
with pytest.raises(TadoBadRequestError):
508-
await python_tado.set_child_lock(
509-
serial_no=device_id, child_lock=invalid_child_lock
510-
)
511-
512501

513502
async def test_add_meter_readings_duplicated(
514503
python_tado: Tado, responses: aioresponses, snapshot: SnapshotAssertion

0 commit comments

Comments
 (0)