Skip to content

Commit 6a005c5

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

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
@@ -1345,6 +1345,22 @@ def read_write_attr(self, val): self._val = val
13451345
runtime="X_FINAL_OK = 1",
13461346
error=None,
13471347
)
1348+
# type[T] class variable with non-type metaclass
1349+
yield Case(
1350+
stub="""
1351+
from abc import ABCMeta
1352+
class W(metaclass=ABCMeta): ...
1353+
class V:
1354+
foo: type[W]
1355+
""",
1356+
runtime="""
1357+
from abc import ABCMeta
1358+
class W(metaclass=ABCMeta): pass
1359+
class V:
1360+
foo = W
1361+
""",
1362+
error=None,
1363+
)
13481364

13491365
@collect_cases
13501366
def test_type_alias(self) -> Iterator[Case]:

0 commit comments

Comments
 (0)