mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Add tests for PyParameterInfoHandler about overloads in imported module
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
import b
|
||||
|
||||
b.foo(<arg1>)
|
||||
@@ -0,0 +1,2 @@
|
||||
def foo(a, b):
|
||||
pass
|
||||
@@ -0,0 +1,7 @@
|
||||
from typing import overload
|
||||
|
||||
@overload
|
||||
def foo(a: str, b: str) -> str: ...
|
||||
|
||||
@overload
|
||||
def foo(a: int, b: int) -> str: ...
|
||||
@@ -0,0 +1,3 @@
|
||||
import b
|
||||
|
||||
b.foo(<arg1>)
|
||||
@@ -0,0 +1,2 @@
|
||||
def foo(a, b=None):
|
||||
pass
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
from typing import overload
|
||||
|
||||
@overload
|
||||
def foo(a: str, b: str) -> str: ...
|
||||
|
||||
@overload
|
||||
def foo(a: int) -> str: ...
|
||||
@@ -487,6 +487,22 @@ public class PyParameterInfoTest extends LightMarkedTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
public void testOverloadsInImportedModule() {
|
||||
myFixture.copyDirectoryToProject("typing", "");
|
||||
|
||||
runWithLanguageLevel(
|
||||
LanguageLevel.PYTHON35,
|
||||
() -> {
|
||||
final int offset = loadMultiFileTest(1).get("<arg1>").getTextOffset();
|
||||
|
||||
final List<String> texts = Arrays.asList("a: int, b: int", "a: str, b: str");
|
||||
final List<String[]> highlighted = Arrays.asList(new String[]{"a: int, "}, new String[]{"a: str, "});
|
||||
|
||||
feignCtrlP(offset).check(texts, highlighted, Arrays.asList(ArrayUtil.EMPTY_STRING_ARRAY, ArrayUtil.EMPTY_STRING_ARRAY));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public void testOverloadsWithDifferentNumberOfArgumentsInImportedClass() {
|
||||
myFixture.copyDirectoryToProject("typing", "");
|
||||
|
||||
@@ -504,6 +520,22 @@ public class PyParameterInfoTest extends LightMarkedTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
public void testOverloadsWithDifferentNumberOfArgumentsInImportedModule() {
|
||||
myFixture.copyDirectoryToProject("typing", "");
|
||||
|
||||
runWithLanguageLevel(
|
||||
LanguageLevel.PYTHON35,
|
||||
() -> {
|
||||
final int offset = loadMultiFileTest(1).get("<arg1>").getTextOffset();
|
||||
|
||||
final List<String> texts = Arrays.asList("a: int", "a: str, b: str");
|
||||
final List<String[]> highlighted = Arrays.asList(new String[]{"a: int"}, new String[]{"a: str, "});
|
||||
|
||||
feignCtrlP(offset).check(texts, highlighted, Arrays.asList(ArrayUtil.EMPTY_STRING_ARRAY, ArrayUtil.EMPTY_STRING_ARRAY));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Imitates pressing of Ctrl+P; fails if results are not as expected.
|
||||
* @param offset offset of 'cursor' where Ctrl+P is pressed.
|
||||
|
||||
Reference in New Issue
Block a user