From 7e4a57d18e1ce88658a5d4fa6c938987dc1c55c4 Mon Sep 17 00:00:00 2001 From: Kharec Date: Tue, 17 Feb 2026 14:25:56 +0100 Subject: [PATCH] test: refactor MockClient state fields into a dataclass --- tests/test_library.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_library.py b/tests/test_library.py index 33ead47..4c84d16 100644 --- a/tests/test_library.py +++ b/tests/test_library.py @@ -1,12 +1,14 @@ +from dataclasses import dataclass, field + from auditui.library import LibraryClient +@dataclass(slots=True) class MockClient: - def __init__(self) -> None: - self.put_calls: list[tuple[str, dict]] = [] - self.post_calls: list[tuple[str, dict]] = [] - self._post_response: dict = {} - self.raise_on_put = False + put_calls: list[tuple[str, dict]] = field(default_factory=list) + post_calls: list[tuple[str, dict]] = field(default_factory=list) + _post_response: dict = field(default_factory=dict) + raise_on_put: bool = False def put(self, path: str, body: dict) -> dict: if self.raise_on_put: