diff --git a/python/testData/inspections/PyNumpyType/ReturnTypeHintHasPriority.py b/python/testData/inspections/PyNumpyType/ReturnTypeHintHasPriority.py index 6b9852839354..25e41df20eb3 100644 --- a/python/testData/inspections/PyNumpyType/ReturnTypeHintHasPriority.py +++ b/python/testData/inspections/PyNumpyType/ReturnTypeHintHasPriority.py @@ -1,4 +1,4 @@ -from typing import Callable +from typing import Callable, assert_type def test_explicit_type() -> Callable[[str, str, str], str]: @@ -32,9 +32,6 @@ def test_numpy_docstring(): ... -def expect_callable(cb: Callable[[str, str, str], str]): ... -def expect_int(x: int): ... - -expect_callable(test_explicit_type()) -expect_callable(test_explicit_type_comment()) -expect_int(test_numpy_docstring()) +assert_type(test_explicit_type(), Callable[[str, str, str], str]) +assert_type(test_explicit_type_comment(), Callable[[str, str, str], str]) +assert_type(test_numpy_docstring(), int) diff --git a/python/testData/inspections/PyNumpyType/ReturnTypeUnion.py b/python/testData/inspections/PyNumpyType/ReturnTypeUnion.py index 17bd1b6a7f91..6032133f6d72 100644 --- a/python/testData/inspections/PyNumpyType/ReturnTypeUnion.py +++ b/python/testData/inspections/PyNumpyType/ReturnTypeUnion.py @@ -1,3 +1,6 @@ +from typing import assert_type + + def test_explicit_union(): """ Returns @@ -34,10 +37,7 @@ def test_pep604_union(): ... -def expect_int_or_str(x: int | str): ... -def expect_list_or_tuple(x: list[int] | tuple[int, int]): ... - -expect_int_or_str(test_explicit_union()) -expect_int_or_str(test_implicit_union()) -expect_list_or_tuple(test_union_with_parameterized()) -expect_int_or_str(test_pep604_union()) +assert_type(test_explicit_union(), int | str) +assert_type(test_implicit_union(), int | str) +assert_type(test_union_with_parameterized(), list[int] | tuple[int, int]) +assert_type(test_pep604_union(), int | str) diff --git a/python/testData/inspections/PyNumpyType/ReturnTypeWithBrackets.py b/python/testData/inspections/PyNumpyType/ReturnTypeWithBrackets.py index 5e956da0288b..c050495169dd 100644 --- a/python/testData/inspections/PyNumpyType/ReturnTypeWithBrackets.py +++ b/python/testData/inspections/PyNumpyType/ReturnTypeWithBrackets.py @@ -1,4 +1,4 @@ -from typing import Callable +from typing import Callable, assert_type def test_callable_from_docstring(): @@ -19,8 +19,5 @@ def test_triple_tuple_from_docstring(): ... -def expect_callable(cb: Callable[[str, str, str], str]): ... -def expect_triple_tuple(t: tuple[int, int, int]): ... - -expect_callable(test_callable_from_docstring()) -expect_triple_tuple(test_triple_tuple_from_docstring()) +assert_type(test_callable_from_docstring(), Callable[[str, str, str], str]) +assert_type(test_triple_tuple_from_docstring(), tuple[int, int, int]) diff --git a/python/testSrc/com/jetbrains/python/inspections/PyNumpyTypeTest.java b/python/testSrc/com/jetbrains/python/inspections/PyNumpyTypeTest.java index 459ea7393265..68d9824f25c7 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyNumpyTypeTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyNumpyTypeTest.java @@ -42,7 +42,7 @@ public class PyNumpyTypeTest extends PyTestCase { settings.setFormat(DocStringFormat.NUMPY); } myFixture.configureByFile(TEST_DIRECTORY + getTestName(false) + ".py"); - myFixture.enableInspections(PyTypeCheckerInspection.class); + myFixture.enableInspections(PyTypeCheckerInspection.class, PyAssertTypeInspection.class); myFixture.checkHighlighting(true, false, true); } finally {