Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion msgspec/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,4 +1002,4 @@ def _translate_inner(
)
return out
else:
return CustomType(t)
return CustomType(t[args] if args else t)
7 changes: 7 additions & 0 deletions tests/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,13 @@ def test_custom():
assert mi.type_info(complex) == mi.CustomType(complex)


def test_custom_with_args():
class MyGeneric(Generic[T]):
value: T

assert mi.type_info(MyGeneric[int]) == mi.CustomType(MyGeneric[int])


@pytest.mark.parametrize(
"kw",
[{}, dict(min_length=0), dict(max_length=3)],
Expand Down