diff --git a/python/testData/inspections/PyTypeCheckerInspection/ClassObjectType.py b/python/testData/inspections/PyTypeCheckerInspection/ClassObjectType.py index 4bb448278189..e30edbc21fda 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/ClassObjectType.py +++ b/python/testData/inspections/PyTypeCheckerInspection/ClassObjectType.py @@ -1,4 +1,4 @@ -from typing import Type, TypeVar +from typing import Type, TypeVar, Optional class MyClass: pass @@ -13,9 +13,9 @@ T1 = TypeVar('T1') def expects_any_class(x: Type[T1]): pass -# expects_any_class(MyClass) +expects_any_class(MyClass) expects_any_class(MyClass()) -# expects_any_class(object) +expects_any_class(object) expects_any_class(object()) T2 = TypeVar('T2', MyClass) @@ -25,4 +25,12 @@ def expects_myclass_descendant(x: Type[T2]): expects_myclass_descendant(MyClass) expects_myclass_descendant(MyClass()) expects_myclass_descendant(object) -expects_myclass_descendant(object()) \ No newline at end of file +expects_myclass_descendant(object()) + +def expects_myclass_descendant_or_none(x: Optional[Type[T2]]): + pass + +expects_myclass_descendant_or_none(MyClass) +expects_myclass_descendant_or_none(MyClass()) +expects_myclass_descendant_or_none(object) +expects_myclass_descendant_or_none(object()) \ No newline at end of file