Skip to content

Commit c628629

Browse files
committed
(fix) get_specialized_type_var_map: generic passthrough
1 parent 7ba5928 commit c628629

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

tests/python_312/test_inspect.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,22 @@ class BinSubclass(Bin): ...
9191
assert get_specialized_type_var_map(Bin) == {"_T": int}
9292

9393

94+
def test_get_specialized_type_var_map_double_generic_passthrough():
95+
@strawberry.type
96+
class Foo[_T]: ...
97+
98+
@strawberry.type
99+
class Bar[_K](Foo[_K]): ...
100+
101+
@strawberry.type
102+
class Bin(Bar[int]): ...
103+
104+
assert get_specialized_type_var_map(Bin) == {
105+
"_T": int,
106+
"_K": int,
107+
}
108+
109+
94110
def test_get_specialized_type_var_map_multiple_inheritance():
95111
@strawberry.type
96112
class Foo[_T]: ...

tests/utils/test_inspect.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,22 @@ class BinSubclass(Bin): ...
9494
assert get_specialized_type_var_map(Bin) == {"_T": int}
9595

9696

97+
def test_get_specialized_type_var_map_double_generic_passthrough():
98+
@strawberry.type
99+
class Foo(Generic[_T]): ...
100+
101+
@strawberry.type
102+
class Bar(Foo[_K], Generic[_K]): ...
103+
104+
@strawberry.type
105+
class Bin(Bar[int]): ...
106+
107+
assert get_specialized_type_var_map(Bin) == {
108+
"_T": int,
109+
"_K": int,
110+
}
111+
112+
97113
def test_get_specialized_type_var_map_multiple_inheritance():
98114
@strawberry.type
99115
class Foo(Generic[_T]): ...

0 commit comments

Comments
 (0)