Skip to content

Commit 60d9261

Browse files
committed
add test_reified_generic_subtype_self test
1 parent cd6ad14 commit 60d9261

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tests/test_reified_generics/test_reified_generic.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from typing import Generic, List, Tuple, TypeVar
1+
from typing import TYPE_CHECKING, Generic, List, Tuple, TypeVar
22

33
from pytest import raises
4+
from typing_extensions import assert_type
45

56
from basedtyping import NotReifiedError, ReifiedGeneric, T
67

@@ -81,3 +82,15 @@ def test_none_type() -> None:
8182
NoneType,
8283
NoneType,
8384
) # type:ignore[comparison-overlap]
85+
86+
87+
if TYPE_CHECKING:
88+
# this is just a type-time test, not a real life pytest test. it's only run by mypy
89+
def test_reified_generic_subtype_self():
90+
"""make sure that the generic in the metaclass doesn't break instance types, and that
91+
the `Self` type works properly on the metaclass"""
92+
93+
class Subtype(Reified[int, int]):
94+
pass
95+
96+
assert_type(Subtype(), Subtype)

0 commit comments

Comments
 (0)