Skip to content

Commit

Permalink
🚨 Fix mypy warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Krupinski committed Jan 17, 2024
1 parent 7a2bb51 commit e673611
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lapidary/runtime/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
def parse_model(response: httpx.Response, typ: ty.Type[T]) -> T:
if inspect.isclass(typ):
if issubclass(typ, pydantic.BaseModel):
return typ.model_validate_json(response.content)
return ty.cast(T, typ.model_validate_json(response.content))

return pydantic.TypeAdapter(typ).validate_json(response.content)

Expand Down
2 changes: 2 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# mypy: disable-error-code="empty-body"

import dataclasses as dc
import unittest

Expand Down
2 changes: 1 addition & 1 deletion tests/test_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MyRequestBodyList(pydantic.RootModel):
request_factory = Mock()
build_request(
operation=OperationModel('GET', 'path', {}, RequestBodyModel('body', {'application/json': MyRequestBodyList}), {}),
actual_params={'body': MyRequestBodyList([MyRequestBodyModel(a='a')])},
actual_params={'body': MyRequestBodyList(root=[MyRequestBodyModel(a='a')])},
request_factory=request_factory
)

Expand Down

0 comments on commit e673611

Please sign in to comment.