Skip to content

Commit c9293ad

Browse files
committed
Simplify testcase, check for occurrence of ValueError
1 parent 81a2ec3 commit c9293ad

File tree

1 file changed

+9
-25
lines changed

1 file changed

+9
-25
lines changed

tests/test_usb.py

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3067,30 +3067,14 @@ async def test_clock_synchronize_month_overflow(
30673067
await self._wait_for_scan(stick)
30683068

30693069
# Get a Circle node
3070-
circle_node = stick.nodes.get("1111111111111111")
3071-
assert circle_node is not None
3072-
await circle_node.load()
3073-
3074-
# Mock CircleClockGetRequest.send() to return a response where
3075-
# day_of_week is Sunday (6) while frozen time is Saturday (5), Jan 31
3076-
# def mock_clock_get_send(self):
3077-
# response = pw_responses.CircleClockResponse()
3078-
# response.timestamp = dt.now(tz=UTC)
3079-
# Set day_of_week to Sunday (6), requiring +1 day from Saturday Jan 31
3080-
# Old code: Jan 31 + 1 = day 32 (ValueError)
3081-
# New code: Jan 31 + timedelta(days=1) = Feb 1 (correct)
3082-
# response.day_of_week.value = 6 # Sunday
3083-
# response.time.value = dt.now(tz=UTC).time()
3084-
# return response
3085-
3086-
# monkeypatch.setattr(
3087-
# pw_requests.CircleClockGetRequest,
3088-
# "send",
3089-
# mock_clock_get_send,
3090-
# )
3091-
3092-
# This should not raise ValueError about invalid day
3093-
# result = await circle_node.clock_synchronize()
3094-
# assert result is True
3070+
circle = stick.nodes.get("1111111111111111")
3071+
assert circle is not None
3072+
result = True
3073+
try:
3074+
await circle.load()
3075+
except ValueError:
3076+
result = False
3077+
3078+
assert result
30953079

30963080
await stick.disconnect()

0 commit comments

Comments
 (0)