mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-18816 Add tests on that annotation content can be retrieved without unstabbing
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
def func() -> int:
|
||||
pass
|
||||
@@ -0,0 +1,2 @@
|
||||
def func(x: int):
|
||||
pass
|
||||
@@ -0,0 +1 @@
|
||||
x: int = ...
|
||||
@@ -726,4 +726,38 @@ public class PyStubsTest extends PyTestCase {
|
||||
assertNotParsed(external);
|
||||
});
|
||||
}
|
||||
|
||||
// PY-18116
|
||||
public void testParameterAnnotation() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON30, () -> {
|
||||
final PyFile file = getTestFile();
|
||||
final PyFunction func = file.findTopLevelFunction("func");
|
||||
final PyNamedParameter param = func.getParameterList().findParameterByName("x");
|
||||
final String annotation = param.getAnnotationContent();
|
||||
assertEquals("int", annotation);
|
||||
assertNotParsed(file);
|
||||
});
|
||||
}
|
||||
|
||||
// PY-18116
|
||||
public void testFunctionAnnotation() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON30, () -> {
|
||||
final PyFile file = getTestFile();
|
||||
final PyFunction func = file.findTopLevelFunction("func");
|
||||
final String annotation = func.getAnnotationContent();
|
||||
assertEquals("int", annotation);
|
||||
assertNotParsed(file);
|
||||
});
|
||||
}
|
||||
|
||||
// PY-18116
|
||||
public void testVariableAnnotation() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON36, () -> {
|
||||
final PyFile file = getTestFile();
|
||||
final PyTargetExpression var = file.findTopLevelAttribute("x");
|
||||
final String annotation = var.getAnnotationContent();
|
||||
assertEquals("int", annotation);
|
||||
assertNotParsed(file);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user