mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
fixed PY-11484 Implement abstract method: pushes docstring out of the way
This commit is contained in:
@@ -156,7 +156,8 @@ public class PyOverrideImplementUtil {
|
||||
final int offset = editor.getCaretModel().getOffset();
|
||||
PsiElement anchor = null;
|
||||
for (PyStatement statement: statementList.getStatements()) {
|
||||
if (statement.getTextRange().getStartOffset() < offset) {
|
||||
if (statement.getTextRange().getStartOffset() < offset ||
|
||||
(statement instanceof PyExpressionStatement && ((PyExpressionStatement)statement).getExpression() instanceof PyStringLiteralExpression)) {
|
||||
anchor = statement;
|
||||
}
|
||||
}
|
||||
|
||||
9
python/testData/override/docstring.py
Normal file
9
python/testData/override/docstring.py
Normal file
@@ -0,0 +1,9 @@
|
||||
class Abstract(object):
|
||||
|
||||
@abstractmethod
|
||||
def foo(self, bar):
|
||||
pass
|
||||
|
||||
|
||||
class Concrete(Abstract):
|
||||
"""The docstring."""
|
||||
12
python/testData/override/docstring_after.py
Normal file
12
python/testData/override/docstring_after.py
Normal file
@@ -0,0 +1,12 @@
|
||||
class Abstract(object):
|
||||
|
||||
@abstractmethod
|
||||
def foo(self, bar):
|
||||
pass
|
||||
|
||||
|
||||
class Concrete(Abstract):
|
||||
"""The docstring."""
|
||||
|
||||
def foo(self, bar):
|
||||
<selection>super(Concrete, self).foo(bar)</selection>
|
||||
@@ -130,6 +130,10 @@ public class PyOverrideTest extends PyTestCase {
|
||||
doTest3k();
|
||||
}
|
||||
|
||||
public void testDocstring() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-10229
|
||||
public void testInstanceCheck() {
|
||||
myFixture.configureByFile("override/" + getTestName(true) + ".py");
|
||||
|
||||
Reference in New Issue
Block a user