diff --git a/mypy/test/teststubgen.py b/mypy/test/teststubgen.py index 1cd463f41160..b175f0b9fed6 100644 --- a/mypy/test/teststubgen.py +++ b/mypy/test/teststubgen.py @@ -8,7 +8,7 @@ import tempfile import unittest from types import ModuleType -from typing import Any, Tuple, TypeVar, cast +from typing import Any, Tuple, TypeVar, cast, no_type_check from typing_extensions import ParamSpec, TypeVarTuple import pytest @@ -944,12 +944,13 @@ class TestClass: gen.generate_class_stub("C", TestClass, output) assert_equal(output, ["class C[T]: ..."]) + # type: ignore used for older versions of python type checking inline generics. + @no_type_check @unittest.skipIf(sys.version_info < (3, 12), "Inline Generics not supported before Python3.12") def test_generic_class(self) -> None: exec("class Test[A]: ...") - # type: ignore used for older versions of python type checking - class TestClass[A]: ... # type: ignore + class TestClass[A]: ... output: list[str] = [] mod = ModuleType("module", "")