Skip to content

Commit a8b869c

Browse files
committed
CR: cleanup test_usb.py
1 parent 8977ed5 commit a8b869c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/test_usb.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,17 @@ def append_response(self, send_response) -> None:
252252
"""Add response to queue."""
253253
self.send_response.append(send_response)
254254

255+
def clear_response(self) -> None:
256+
"""Clear response queue."""
257+
self.send_response.clear()
258+
255259
async def send(
256260
self,
257261
request: pw_requests.PlugwiseRequest, # type: ignore[name-defined]
258262
suppress_node_errors=True,
259263
) -> pw_responses.PlugwiseResponse | None: # type: ignore[name-defined]
260264
"""Submit request to queue and return response."""
261-
if len(self.send_response) > 0:
265+
if self.send_response:
262266
return self.send_response.pop(0)
263267
return None
264268

@@ -2296,7 +2300,7 @@ async def load_callback(event: pw_api.NodeEvent, mac: str) -> None: # type: ign
22962300
)
22972301

22982302
# scan with cache enabled
2299-
mock_stick_controller.send_response = []
2303+
mock_stick_controller.clear_response()
23002304
test_scan = pw_scan.PlugwiseScan(
23012305
"1298347650AFBECD",
23022306
pw_api.NodeType.SCAN,

0 commit comments

Comments
 (0)