fixed PY-11484 Implement abstract method: pushes docstring out of the way

This commit is contained in:
Ekaterina Tuzova
2014-01-24 12:21:44 +04:00
parent 43e98b8e2a
commit 21e2c1debc
4 changed files with 27 additions and 1 deletions

View File

@@ -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;
}
}

View File

@@ -0,0 +1,9 @@
class Abstract(object):
@abstractmethod
def foo(self, bar):
pass
class Concrete(Abstract):
"""The docstring."""

View 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>

View File

@@ -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");