mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
PY-29717 Add missing tests on parameter formatting
This commit is contained in:
@@ -190,7 +190,7 @@ public class PyDocumentationBuilder {
|
||||
|
||||
private void buildFromParameter(@NotNull PyNamedParameter parameter) {
|
||||
final PyFunction func = PsiTreeUtil.getParentOfType(parameter, PyFunction.class, true, PyLambdaExpression.class);
|
||||
final String link = func != null ? getLinkToFunction(func, true) : PyNames.UNNAMED_ELEMENT;
|
||||
final String link = func != null ? getLinkToFunction(func, true) : StringUtil.escapeXml(PyNames.UNNAMED_ELEMENT);
|
||||
if (link != null) {
|
||||
myProlog
|
||||
.addItem("Parameter ")
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html><body><div class='definition'><pre>Parameter <b>param</b> of func<br>param: Any</pre></div></body></html>
|
||||
@@ -0,0 +1,2 @@
|
||||
def func(par<the_ref>am):
|
||||
pass
|
||||
@@ -0,0 +1,2 @@
|
||||
def func(par<the_ref>am):
|
||||
pass
|
||||
1
python/testData/quickdoc/ParamOfInnerClassMethod.html
Normal file
1
python/testData/quickdoc/ParamOfInnerClassMethod.html
Normal file
@@ -0,0 +1 @@
|
||||
<html><body><div class='definition'><pre>Parameter <b>param</b> of MyClass.method<br>param: Any</pre></div></body></html>
|
||||
4
python/testData/quickdoc/ParamOfInnerClassMethod.py
Normal file
4
python/testData/quickdoc/ParamOfInnerClassMethod.py
Normal file
@@ -0,0 +1,4 @@
|
||||
def hidden():
|
||||
class MyClass:
|
||||
def method(self, pa<the_ref>ram):
|
||||
pass
|
||||
1
python/testData/quickdoc/ParamOfInnerFunction.html
Normal file
1
python/testData/quickdoc/ParamOfInnerFunction.html
Normal file
@@ -0,0 +1 @@
|
||||
<html><body><div class='definition'><pre>Parameter <b>param</b> of func<br>param: Any</pre></div></body></html>
|
||||
3
python/testData/quickdoc/ParamOfInnerFunction.py
Normal file
3
python/testData/quickdoc/ParamOfInnerFunction.py
Normal file
@@ -0,0 +1,3 @@
|
||||
def hidden():
|
||||
def func(par<the_ref>am):
|
||||
pass
|
||||
1
python/testData/quickdoc/ParamOfLambda.html
Normal file
1
python/testData/quickdoc/ParamOfLambda.html
Normal file
@@ -0,0 +1 @@
|
||||
<html><body><div class='definition'><pre>Parameter <b>param</b> of <unnamed><br>param: Any</pre></div></body></html>
|
||||
1
python/testData/quickdoc/ParamOfLambda.py
Normal file
1
python/testData/quickdoc/ParamOfLambda.py
Normal file
@@ -0,0 +1 @@
|
||||
func = lambda pa<the_ref>ram: 42
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python;
|
||||
|
||||
import com.intellij.codeInsight.TargetElementUtil;
|
||||
import com.intellij.codeInsight.documentation.DocumentationManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.python.documentation.PyDocumentationSettings;
|
||||
@@ -38,12 +37,12 @@ public class PyQuickDocTest extends LightMarkedTestCase {
|
||||
}
|
||||
|
||||
private void checkByHTML(@NotNull String text) {
|
||||
assertSameLinesWithFile(getTestDataPath() + "/quickdoc/" + getTestName(false) + ".html", text);
|
||||
assertSameLinesWithFile(getTestDataPath() + getTestName(false) + ".html", text);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, PsiElement> loadTest() {
|
||||
return configureByFile("/quickdoc/" + getTestName(false) + ".py");
|
||||
return configureByFile(getTestName(false) + ".py");
|
||||
}
|
||||
|
||||
private void checkRefDocPair() {
|
||||
@@ -215,6 +214,29 @@ public class PyQuickDocTest extends LightMarkedTestCase {
|
||||
checkHTMLOnly();
|
||||
}
|
||||
|
||||
public void testParamOfInnerFunction() {
|
||||
checkHTMLOnly();
|
||||
}
|
||||
|
||||
public void testParamOfInnerClassMethod() {
|
||||
checkHTMLOnly();
|
||||
}
|
||||
|
||||
public void testParamOfFunctionInModuleWithIllegalName() {
|
||||
final Map<String, PsiElement> marks = configureByFile(getTestName(false) + "/illegal name.py");
|
||||
final PsiElement originalElement = marks.get("<the_ref>");
|
||||
final DocumentationManager manager = DocumentationManager.getInstance(myFixture.getProject());
|
||||
final PsiElement target = manager.findTargetElement(myFixture.getEditor(),
|
||||
originalElement.getTextOffset(),
|
||||
myFixture.getFile(),
|
||||
originalElement);
|
||||
checkByHTML(myProvider.generateDoc(target, originalElement));
|
||||
}
|
||||
|
||||
public void testParamOfLambda() {
|
||||
checkHTMLOnly();
|
||||
}
|
||||
|
||||
public void testInstanceAttr() {
|
||||
checkHTMLOnly();
|
||||
}
|
||||
@@ -251,7 +273,7 @@ public class PyQuickDocTest extends LightMarkedTestCase {
|
||||
|
||||
// PY-13422
|
||||
public void testNumPyOnesDoc() {
|
||||
myFixture.copyDirectoryToProject("/quickdoc/" + getTestName(false), "");
|
||||
myFixture.copyDirectoryToProject(getTestName(false), "");
|
||||
checkHover();
|
||||
}
|
||||
|
||||
@@ -418,4 +440,9 @@ public class PyQuickDocTest extends LightMarkedTestCase {
|
||||
public void testSingleLineAssignedValueForTarget() {
|
||||
checkHTMLOnly();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return super.getTestDataPath() + "/quickdoc/";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user