mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-03 15:50:52 +07:00
Tests to PY-286 related __doc__ resolution.
This commit is contained in:
5
python/testData/resolve/DocStringClass.py
Normal file
5
python/testData/resolve/DocStringClass.py
Normal file
@@ -0,0 +1,5 @@
|
||||
class Foo:
|
||||
"Docstring of class Foo"
|
||||
pass
|
||||
|
||||
Foo._<ref>_doc__
|
||||
5
python/testData/resolve/DocStringFunction.py
Normal file
5
python/testData/resolve/DocStringFunction.py
Normal file
@@ -0,0 +1,5 @@
|
||||
def bar():
|
||||
"Docstring of function bar"
|
||||
retrun 1
|
||||
|
||||
bar._<ref>_doc__
|
||||
8
python/testData/resolve/DocStringInstance.py
Normal file
8
python/testData/resolve/DocStringInstance.py
Normal file
@@ -0,0 +1,8 @@
|
||||
class Foo:
|
||||
"Docstring of class Foo"
|
||||
pass
|
||||
|
||||
foo = Foo()
|
||||
|
||||
foo._<ref>_doc__
|
||||
|
||||
5
python/testData/resolve/DocStringInvalid.py
Normal file
5
python/testData/resolve/DocStringInvalid.py
Normal file
@@ -0,0 +1,5 @@
|
||||
class Foo:
|
||||
"This is not " + "a doc string"
|
||||
pass
|
||||
|
||||
Foo._<ref>_.doc__
|
||||
5
python/testData/resolve/DocStringModule.py
Normal file
5
python/testData/resolve/DocStringModule.py
Normal file
@@ -0,0 +1,5 @@
|
||||
"Docstring of our own module"
|
||||
|
||||
import DocStringModule as m
|
||||
|
||||
m._<ref>_doc__
|
||||
@@ -183,6 +183,29 @@ public class PyResolveTest extends PyResolveTestCase {
|
||||
}
|
||||
|
||||
|
||||
public void testDocStringClass() throws Exception {
|
||||
PsiElement targetElement = resolve();
|
||||
assertTrue(targetElement instanceof PyStringLiteralExpression);
|
||||
assertEquals("Docstring of class Foo", ((PyStringLiteralExpression)targetElement).getStringValue());
|
||||
}
|
||||
|
||||
public void testDocStringInstance() throws Exception {
|
||||
PsiElement targetElement = resolve();
|
||||
assertTrue(targetElement instanceof PyStringLiteralExpression);
|
||||
assertEquals("Docstring of class Foo", ((PyStringLiteralExpression)targetElement).getStringValue());
|
||||
}
|
||||
|
||||
public void testDocStringFunction() throws Exception {
|
||||
PsiElement targetElement = resolve();
|
||||
assertTrue(targetElement instanceof PyStringLiteralExpression);
|
||||
assertEquals("Docstring of function bar", ((PyStringLiteralExpression)targetElement).getStringValue());
|
||||
}
|
||||
|
||||
public void testDocStringInvalid() throws Exception {
|
||||
PsiElement targetElement = resolve();
|
||||
assertNull(targetElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PythonTestUtil.getTestDataPath() + "/resolve/";
|
||||
|
||||
Reference in New Issue
Block a user