Skip to content

Commit 216effd

Browse files
[stubtest] Fix false positives for type[TypeVar] defaults
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
1 parent 6a32949 commit 216effd

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

mypy/test/teststubtest.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,22 @@ def read_write_attr(self, val): self._val = val
12341234
runtime="X_FINAL_OK = 1",
12351235
error=None,
12361236
)
1237+
# type[T] class variable with non-type metaclass
1238+
yield Case(
1239+
stub="""
1240+
from abc import ABCMeta
1241+
class W(metaclass=ABCMeta): ...
1242+
class V:
1243+
foo: type[W]
1244+
""",
1245+
runtime="""
1246+
from abc import ABCMeta
1247+
class W(metaclass=ABCMeta): pass
1248+
class V:
1249+
foo = W
1250+
""",
1251+
error=None,
1252+
)
12371253

12381254
@collect_cases
12391255
def test_type_alias(self) -> Iterator[Case]:

0 commit comments

Comments
 (0)