Skip to content

Commit 2e0cbdb

Browse files
committed
Refactor docstrings for clarity and enhance test descriptions for payload handling
1 parent 7ee723f commit 2e0cbdb

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

pyoverkiz/client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,13 +637,11 @@ async def execute_action_group(
637637
mode: CommandMode | None = None,
638638
label: str | None = "python-overkiz-api",
639639
) -> str:
640-
"""
641-
Execute a non-persistent action group
640+
"""Execute a non-persistent action group.
642641
643642
The executed action group does not have to be persisted on the server before use.
644643
Per-session rate-limit : 1 calls per 28min 48s period for all operations of the same category (exec)
645644
"""
646-
647645
"""Send several commands in one call"""
648646

649647
# Build a logical (snake_case) payload using model helpers and convert it

tests/test_models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ def test_bad_list_value(self):
303303

304304

305305
def test_command_to_payload_omits_none():
306+
"""Command.to_payload omits None fields from the resulting payload."""
306307
from pyoverkiz.enums.command import OverkizCommand
307308
from pyoverkiz.models import Command
308309

@@ -313,6 +314,7 @@ def test_command_to_payload_omits_none():
313314

314315

315316
def test_action_to_payload_and_parameters_conversion():
317+
"""Action.to_payload converts nested Command enums to primitives."""
316318
from pyoverkiz.enums.command import OverkizCommand, OverkizCommandParam
317319
from pyoverkiz.models import Action, Command
318320

tests/test_serializers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
"""Tests for pyoverkiz.serializers."""
2+
13
from __future__ import annotations
24

35
from pyoverkiz.serializers import prepare_payload
46

57

68
def test_prepare_payload_camelizes_and_fixes_device_url():
9+
"""Test that prepare_payload converts snake_case to camelCase and fixes abbreviations."""
710
payload = {
811
"label": "test",
912
"actions": [{"device_url": "rts://1/2", "commands": [{"name": "close"}]}],
@@ -17,6 +20,7 @@ def test_prepare_payload_camelizes_and_fixes_device_url():
1720

1821

1922
def test_prepare_payload_nested_lists_and_dicts():
23+
"""Test that prepare_payload handles nested lists and dicts correctly."""
2024
payload = {
2125
"actions": [
2226
{

0 commit comments

Comments
 (0)