Skip to content

Commit a26a036

Browse files
lesnik512claude
andcommitted
test(story-2.2): extend repr test to cover after_response and on_error
Closes the 95% → 100% coverage gap on src/httpware/middleware/__init__.py flagged by the final code review. The three __repr__ bodies are structurally identical, but the spec called for 100% line coverage. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6d6ff07 commit a26a036

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

tests/test_middleware.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,20 @@ def test_repr_shows_original_function_name() -> None:
458458
async def my_stamp(request: Request) -> Request:
459459
return request
460460

461-
text = repr(my_stamp)
462-
assert "before_request" in text
463-
assert "my_stamp" in text
461+
@after_response
462+
async def my_tag(request: Request, response: Response) -> Response: # noqa: ARG001
463+
return response
464+
465+
@on_error
466+
async def my_recover(request: Request, exc: Exception) -> Response | None: # noqa: ARG001
467+
return None
468+
469+
assert "before_request" in repr(my_stamp)
470+
assert "my_stamp" in repr(my_stamp)
471+
assert "after_response" in repr(my_tag)
472+
assert "my_tag" in repr(my_tag)
473+
assert "on_error" in repr(my_recover)
474+
assert "my_recover" in repr(my_recover)
464475

465476

466477
def test_decorators_reexported_at_package_root() -> None:

0 commit comments

Comments
 (0)