PY-85027 Add regression tests

GitOrigin-RevId: 14606341ba91426d27c8a82c64927636830c8b54
This commit is contained in:
Mikhail Golubev
2025-12-09 11:32:03 +00:00
committed by intellij-monorepo-bot
parent 75d5a08801
commit 57405bf4d6
3 changed files with 57 additions and 0 deletions
@@ -0,0 +1,11 @@
from typing import Callable
def outer_decorator[**P, T](f: Callable[P, T]) -> Callable[P, T]:
return f
class NonWorkingClass:
@outer_decorator
def add_two(self, x: float, y: float) -> float:
return x + y
@@ -6808,6 +6808,34 @@ public class PyTypingTest extends PyTestCase {
""");
}
// PY-85027
public void testImportedBoundMethodDecoratedWithParamSpec() {
doMultiFileStubAwareTest("(x: float, y: float) -> float", """
from mod import NonWorkingClass
expr = NonWorkingClass().add_two
""");
}
// PY-85027
public void testBoundMethodDecoratedWithParamSpec() {
doTest("(x: float, y: float) -> float", """
from typing import Callable
def outer_decorator[**P, T](f: Callable[P, T]) -> Callable[P, T]:
return f
class NonWorkingClass:
@outer_decorator
def add_two(self, x: float, y: float) -> float:
return x + y
expr = NonWorkingClass().add_two
""");
}
private void doTestNoInjectedText(@NotNull String text) {
myFixture.configureByText(PythonFileType.INSTANCE, text);
final InjectedLanguageManager languageManager = InjectedLanguageManager.getInstance(myFixture.getProject());
@@ -644,4 +644,22 @@ public class Py3ArgumentListInspectionTest extends PyInspectionTestCase {
public void testImportedDecoratedFunctionWithParamSpec() {
doMultiFileTest();
}
// PY-85027
public void testBoundMethodDecoratedWithParamSpec() {
doTestByText("""
from typing import Callable
def outer_decorator[**P, T](f: Callable[P, T]) -> Callable[P, T]:
return f
class NonWorkingClass:
@outer_decorator
def add_two(self, x: float, y: float) -> float:
return x + y
NonWorkingClass().add_two(<warning descr="Parameter 'x' unfilled"><warning descr="Parameter 'y' unfilled">)</warning></warning>
""");
}
}