Skip to content

Commit

Permalink
Merge pull request #253 from reagento/fix/type-inside-no-coercer-error
Browse files Browse the repository at this point in the history
fix column-property (#250)
  • Loading branch information
zhPavel authored Mar 6, 2024
2 parents 34cee70 + ba1bce8 commit 88bdf0e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/changelog/fragments/252.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No coercer error is now contains type information
2 changes: 1 addition & 1 deletion src/adaptix/_internal/conversion/request_cls.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class UnlinkedOptionalPolicy:


@dataclass(frozen=True)
class UnlinkedOptionalPolicyRequest(LocatedRequest):
class UnlinkedOptionalPolicyRequest(LocatedRequest[UnlinkedOptionalPolicy]):
pass


Expand Down
7 changes: 6 additions & 1 deletion src/adaptix/_internal/retort/operating_retort.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,14 @@ def _get_coercer_request_description(self, request: CoercerRequest) -> str:

src_owner = self._get_type_desc(src_owner_loc_map[TypeHintLoc].type)
src_field = src_field_loc_map[FieldLoc].field_id
src_tp = self._get_type_desc(src_field_loc_map[TypeHintLoc].type)
dst_owner = self._get_type_desc(dst_owner_loc_map[TypeHintLoc].type)
dst_field = dst_field_loc_map[FieldLoc].field_id
return f"Cannot find coercer for linking `{src_owner}.{src_field} -> {dst_owner}.{dst_field}`"
dst_tp = self._get_type_desc(dst_field_loc_map[TypeHintLoc].type)
return (
f"Cannot find coercer for linking"
f" `{src_owner}.{src_field}: {src_tp} -> {dst_owner}.{dst_field}: {dst_tp}`"
)

def _get_type_desc(self, tp: TypeHint) -> str:
try:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/retort/test_operating_retort.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class BookDTO:
[
CannotProvide(
f"Cannot find coercer for linking"
f" `{Book.__qualname__}.author -> {BookDTO.__qualname__}.author`",
f" `{Book.__qualname__}.author: int -> {BookDTO.__qualname__}.author: str`",
is_terminal=False,
is_demonstrative=True,
),
Expand Down

0 comments on commit 88bdf0e

Please sign in to comment.