Skip to content

Commit e19b91a

Browse files
franccescoclaude
andcommitted
test: update tests for refactored error handling
- Update test_async_todos_extra to expect HTTPStatusError - Update test_misc_coverage for renamed users_transform module Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 54facee commit e19b91a

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

tests/test_async_todos_extra.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,20 @@ async def test_update_raises_on_failure(
8383
self, async_client: AsyncClient, mock_async_client: AsyncMock
8484
) -> None:
8585
"""Test that update raises error on failure."""
86+
from httpx import HTTPStatusError, Request, Response
87+
8688
mock_response = MagicMock()
8789
mock_response.status_code = 400
88-
mock_response.raise_for_status = MagicMock()
90+
mock_response.raise_for_status.side_effect = HTTPStatusError(
91+
"Bad Request",
92+
request=MagicMock(spec=Request),
93+
response=MagicMock(spec=Response, status_code=400),
94+
)
8995

9096
mock_async_client.put.return_value = mock_response
9197

92-
# Call the method and expect error
93-
with pytest.raises(RuntimeError, match="Failed to update todo"):
98+
# Call the method and expect HTTPStatusError from raise_for_status()
99+
with pytest.raises(HTTPStatusError):
94100
await async_client.todo.update(
95101
todo_id=1,
96102
title="Updated Task",

tests/test_misc_coverage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def test_configuration_type_checking(self) -> None:
9797

9898
def test_mixins_type_checking(self) -> None:
9999
"""Test mixins TYPE_CHECKING imports."""
100-
from bloomy.operations.mixins import users
100+
from bloomy.operations.mixins import users_transform
101101

102102
# Mixins should have TYPE_CHECKING
103-
assert hasattr(users, "TYPE_CHECKING")
103+
assert hasattr(users_transform, "TYPE_CHECKING")

0 commit comments

Comments
 (0)