mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
PY-52574: Update tests after removing Epytext docstring format
(cherry picked from commit d4a90a8da56ca889cf380aa5bc72ac82b0716abc) IJ-CR-148150 GitOrigin-RevId: 235a0e447d84c96e9963235615b07a1caf371e74
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2ac1a788e3
commit
92365f2246
@@ -619,10 +619,6 @@ public abstract class PyCommonResolveTest extends PyCommonResolveTestCase {
|
||||
runWithDocStringFormat(DocStringFormat.GOOGLE, () -> assertResolvesTo(PyTargetExpression.class, "module_level_variable1"));
|
||||
}
|
||||
|
||||
public void testEpyDocTypeReferenceForInstanceAttributeInClassLevelDocstring() {
|
||||
runWithDocStringFormat(DocStringFormat.EPYTEXT, () -> assertResolvesTo(PyTargetExpression.class, "attr"));
|
||||
}
|
||||
|
||||
// PY-7541
|
||||
public void testLoopToUpperReassignment() {
|
||||
final PsiReference ref = findReferenceByMarker();
|
||||
|
||||
@@ -537,28 +537,6 @@ public abstract class PythonCommonCompletionTest extends PythonCommonTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testEpydocParamTag() {
|
||||
runWithDocStringFormat(DocStringFormat.EPYTEXT, this::doTest);
|
||||
}
|
||||
|
||||
public void testEpydocTags() {
|
||||
runWithDocStringFormat(DocStringFormat.EPYTEXT, () -> {
|
||||
myFixture.configureByFile("epydocTags.py");
|
||||
myFixture.completeBasic();
|
||||
final List<String> lookupElementStrings = myFixture.getLookupElementStrings();
|
||||
assertNotNull(lookupElementStrings);
|
||||
assertTrue(lookupElementStrings.contains("@param"));
|
||||
});
|
||||
}
|
||||
|
||||
public void testEpydocTagsMiddle() {
|
||||
runWithDocStringFormat(DocStringFormat.EPYTEXT, () -> {
|
||||
myFixture.configureByFile("epydocTagsMiddle.py");
|
||||
myFixture.completeBasic();
|
||||
myFixture.checkResultByFile("epydocTagsMiddle.after.py");
|
||||
});
|
||||
}
|
||||
|
||||
public void testIdentifiersInPlainDocstring() {
|
||||
runWithDocStringFormat(DocStringFormat.PLAIN, () -> {
|
||||
myFixture.configureByFile("identifiersInPlainDocstring.py");
|
||||
@@ -628,7 +606,7 @@ public abstract class PythonCommonCompletionTest extends PythonCommonTestCase {
|
||||
|
||||
// PY-16870, PY-16972
|
||||
public void testClassNameInDocstring() {
|
||||
runWithDocStringFormat(DocStringFormat.EPYTEXT, this::doTest);
|
||||
runWithDocStringFormat(DocStringFormat.REST, this::doTest);
|
||||
}
|
||||
|
||||
// PY-17002
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
def foo(a, b):
|
||||
"""<caret>
|
||||
pass
|
||||
|
||||
def foo1():
|
||||
"""
|
||||
:return :
|
||||
"""
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
def foo(a, b):
|
||||
"""
|
||||
<caret>
|
||||
@param a:
|
||||
@param b:
|
||||
@return:
|
||||
"""
|
||||
pass
|
||||
|
||||
def foo1():
|
||||
"""
|
||||
:return :
|
||||
"""
|
||||
@@ -2,10 +2,10 @@
|
||||
def foo(a):
|
||||
"""
|
||||
<caret>
|
||||
@param a:
|
||||
@type a:
|
||||
@return:
|
||||
@rtype:
|
||||
:param a:
|
||||
:type a:
|
||||
:return:
|
||||
:rtype:
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@@ -3,6 +3,6 @@ class MyClass:
|
||||
|
||||
def f(x):
|
||||
"""
|
||||
@param x:
|
||||
@type x: MyClass
|
||||
:param x:
|
||||
:type x: MyClass
|
||||
"""
|
||||
@@ -3,6 +3,6 @@ class MyClass:
|
||||
|
||||
def f(x):
|
||||
"""
|
||||
@param x:
|
||||
@type x: MyC<caret>
|
||||
:param x:
|
||||
:type x: MyC<caret>
|
||||
"""
|
||||
@@ -1,2 +0,0 @@
|
||||
def foo(bar):
|
||||
""" @param bar """
|
||||
@@ -1,2 +0,0 @@
|
||||
def foo(bar):
|
||||
""" @param b<caret> """
|
||||
@@ -1,2 +0,0 @@
|
||||
def foo(bar):
|
||||
""" <caret> """
|
||||
@@ -1,2 +0,0 @@
|
||||
def foo(bar):
|
||||
""" @param """
|
||||
@@ -1,2 +0,0 @@
|
||||
def foo(bar):
|
||||
""" @pa<caret> """
|
||||
@@ -4,10 +4,10 @@ def foo(a, <weak_warning descr="Missing parameter b in docstring"><caret>b</weak
|
||||
some description
|
||||
another line of description
|
||||
|
||||
@param a: some description
|
||||
:param a: some description
|
||||
of param
|
||||
@param <weak_warning descr="Unexpected parameter c in docstring">c</weak_warning>: another description
|
||||
:param <weak_warning descr="Unexpected parameter c in docstring">c</weak_warning>: another description
|
||||
of param
|
||||
@return:
|
||||
:return:
|
||||
"""
|
||||
pass
|
||||
@@ -4,10 +4,10 @@ def foo(a, <weak_warning descr="Missing parameter b in docstring">b</weak_warnin
|
||||
some description
|
||||
another line of description
|
||||
|
||||
@param a: some description
|
||||
:param a: some description
|
||||
of param
|
||||
@param <weak_warning descr="Unexpected parameter c in docstring"><caret>c</weak_warning>: another description
|
||||
:param <weak_warning descr="Unexpected parameter c in docstring"><caret>c</weak_warning>: another description
|
||||
of param
|
||||
@return:
|
||||
:return:
|
||||
"""
|
||||
pass
|
||||
@@ -4,8 +4,8 @@ def foo(a, b, f):
|
||||
some description
|
||||
another line of description
|
||||
|
||||
@param a: some description
|
||||
:param a: some description
|
||||
of param
|
||||
@return:
|
||||
:return:
|
||||
"""
|
||||
pass
|
||||
@@ -1,6 +1,6 @@
|
||||
""" file's docstring """
|
||||
def spam(<weak_warning descr="Missing parameter ham in docstring">ha<caret>m</weak_warning>, eggs): # <== PyCharm suggests to apply quickfix there
|
||||
"""Docstring
|
||||
@param eggs:
|
||||
:param eggs:
|
||||
"""
|
||||
pass
|
||||
@@ -1,7 +1,7 @@
|
||||
""" file's docstring """
|
||||
def spam(ham, eggs): # <== PyCharm suggests to apply quickfix there
|
||||
"""Docstring
|
||||
@param ham:
|
||||
@param eggs:
|
||||
:param ham:
|
||||
:param eggs:
|
||||
"""
|
||||
pass
|
||||
@@ -4,11 +4,11 @@ def foo(a, b, f):
|
||||
some description
|
||||
another line of description
|
||||
|
||||
@param b:
|
||||
@param a: some description
|
||||
:param b:
|
||||
:param a: some description
|
||||
of param
|
||||
@param c: another description
|
||||
:param c: another description
|
||||
of param
|
||||
@return:
|
||||
:return:
|
||||
"""
|
||||
pass
|
||||
@@ -2,25 +2,25 @@
|
||||
def foo1(a, b):
|
||||
"""
|
||||
|
||||
@param a:
|
||||
@param b:
|
||||
@return:
|
||||
:param a:
|
||||
:param b:
|
||||
:return:
|
||||
"""
|
||||
pass
|
||||
|
||||
def foo(a, <weak_warning descr="Missing parameter b in docstring">b</weak_warning>, <weak_warning descr="Missing parameter n in docstring">n</weak_warning>):
|
||||
"""
|
||||
|
||||
@param a:
|
||||
@return:
|
||||
:param a:
|
||||
:return:
|
||||
"""
|
||||
pass
|
||||
|
||||
def foo():
|
||||
"""
|
||||
|
||||
@param <weak_warning descr="Unexpected parameter a in docstring">a</weak_warning>:
|
||||
@return:
|
||||
:param <weak_warning descr="Unexpected parameter a in docstring">a</weak_warning>:
|
||||
:return:
|
||||
"""
|
||||
pass
|
||||
|
||||
@@ -36,17 +36,17 @@ def compare(a, b, *, key=None):
|
||||
|
||||
def foo(a, <weak_warning descr="Missing parameter c in docstring">c</weak_warning>):
|
||||
"""
|
||||
@param a:
|
||||
@param <weak_warning descr="Unexpected parameter b in docstring">b</weak_warning>:
|
||||
@return:
|
||||
:param a:
|
||||
:param <weak_warning descr="Unexpected parameter b in docstring">b</weak_warning>:
|
||||
:return:
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def varargs_undefined(x, *args, y, **kwargs):
|
||||
"""
|
||||
@param x:
|
||||
@param y:
|
||||
:param x:
|
||||
:param y:
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<html><body><div class="bottom"><icon src="AllIcons.Nodes.Package"/> <code><a href="psi_element://#module#ClassAndInstanceAttributesInOneSectionEpydoc">ClassAndInstanceAttributesInOneSectionEpydoc</a></code></div><div class="definition"><pre><span style="color:#000080;font-weight:bold;">class </span><span style="color:#000000;">MyClass</span></pre></div><div class="content">Unittest placeholder</div><table class="sections"><tr><td class="section" valign="top">Attributes:</td><td valign="top"><p><code>msg</code> – Message</p><p><code>code</code> – Code</p><p><code>state</code> – State</p></td></tr></table></body></html>
|
||||
@@ -1,12 +0,0 @@
|
||||
class My<the_ref>Class:
|
||||
"""
|
||||
@ivar msg: Message
|
||||
@cvar code: Code
|
||||
@var state: State
|
||||
"""
|
||||
|
||||
code = 404
|
||||
|
||||
def __init__(self):
|
||||
self.msg = 'test'
|
||||
self.state = 0
|
||||
@@ -1 +0,0 @@
|
||||
<html><body><div class="bottom"><icon src="AllIcons.Nodes.Package"/> <code><a href="psi_element://#module#KeywordArgsDescriptionEpydoc">KeywordArgsDescriptionEpydoc</a></code></div><div class="definition"><pre><span style="color:#000080;font-weight:bold;">def </span><span style="color:#000000;">func</span><span style="">(</span><span style="color:#000000;">**args</span><span style="">: </span><span style="color:#000000;">Any</span><span style="">)</span> -> <span style="color:#000000;"><span style="color:#000080;font-weight:bold;">None</span></span></pre></div><div class="content">Unittest placeholder</div><table class="sections"><tr><td class="section" valign="top">Keyword args:</td><td valign="top"><p><code>baz</code></p><p><code>foo</code> – bar</p><p><code>quux</code></p></td></tr></table></body></html>
|
||||
@@ -1,6 +0,0 @@
|
||||
def fu<the_ref>nc(**args):
|
||||
"""
|
||||
@kwarg foo: bar
|
||||
@keyword baz:
|
||||
@kwparam quux:
|
||||
"""
|
||||
@@ -3,11 +3,11 @@ def foo(name):
|
||||
Convert a string like a variable name into a slightly more human-friendly
|
||||
string with spaces and capitalized letters.
|
||||
|
||||
@type name: C{str}
|
||||
@param name: The name to convert to a label. This must be a string
|
||||
:type name: C{str}
|
||||
:param name: The name to convert to a label. This must be a string
|
||||
which could be used as a Python identifier. Strings which do not take
|
||||
this form will result in unpredictable behavior.
|
||||
|
||||
@rtype: C{str}
|
||||
:rtype: C{str}
|
||||
"""
|
||||
print <the_ref>name
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<html><body><div class="bottom"><icon src="AllIcons.Nodes.Package"/> <code><a href="psi_element://#module#ParamAndReturnValueDescriptionNoTagsEpytext">ParamAndReturnValueDescriptionNoTagsEpytext</a></code></div><div class="definition"><pre><span style="color:#000080;font-weight:bold;">def </span><span style="color:#000000;">func</span><span style="">(</span><span style="color:#000000;">param1</span><span style="">: </span><span style="color:#000000;">Any</span><span style="">)</span> -> <span style="color:#000000;"><span style="color:#000080;font-weight:bold;">None</span></span></pre></div><div class="content">Unittest placeholder</div><table class="sections"><tr><td class="section" valign="top">Params:</td><td valign="top"><p><code>param1</code></p></td></tr></table></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body><div class="bottom"><icon src="AllIcons.Nodes.Package"/> <code><a href="psi_element://#module#ParamAndReturnValueDescriptionNoTagsRest">ParamAndReturnValueDescriptionNoTagsRest</a></code></div><div class="definition"><pre><span style="color:#000080;font-weight:bold;">def </span><span style="color:#000000;">func</span><span style="">(</span><span style="color:#000000;">param1</span><span style="">: </span><span style="color:#000000;">Any</span><span style="">)</span> -> <span style="color:#000000;"><span style="color:#000080;font-weight:bold;">None</span></span></pre></div><div class="content">Unittest placeholder</div><table class="sections"><tr><td class="section" valign="top">Params:</td><td valign="top"><p><code>param1</code></p></td></tr></table></body></html>
|
||||
@@ -1,2 +0,0 @@
|
||||
<html><body><div class="bottom"><icon src="AllIcons.Nodes.Package"/> <code><a href="psi_element://#module#ParamDescriptionEpytext">ParamDescriptionEpytext</a></code></div><div class="definition"><pre><span style="color:#000080;font-weight:bold;">def </span><span style="color:#000000;">func</span><span style="">(</span><span style="color:#000000;">param1</span><span style="">: </span><span style="color:#000000;">Any</span><span style="">,</span>
|
||||
<span style="color:#000000;">param2</span><span style="">: </span><span style="color:#000000;">Any</span><span style="">)</span> -> <span style="color:#000000;"><span style="color:#000080;font-weight:bold;">None</span></span></pre></div><div class="content">Unittest placeholder</div><table class="sections"><tr><td class="section" valign="top">Params:</td><td valign="top"><p><code>param1</code> – param1 description</p><p><code>param2</code> – param2 description</p></td></tr><tr><td class="section" valign="top">Returns:</td><td valign="top">return description</td></tr></table></body></html>
|
||||
@@ -1,7 +0,0 @@
|
||||
def fu<the_ref>nc(param1, param2):
|
||||
"""
|
||||
|
||||
@param param1: param1 description
|
||||
@param param2: param2 description
|
||||
@return: return description
|
||||
"""
|
||||
@@ -1,8 +1,8 @@
|
||||
class SomeClass(object):
|
||||
""" Awesome class
|
||||
|
||||
@ivar someVar: great stuff
|
||||
@type someVar: string
|
||||
:ivar someVar: great stuff
|
||||
:type someVar: string
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class SomeClass(object):
|
||||
""" Awesome class
|
||||
|
||||
@ivar bar: great stuff
|
||||
@type bar: string
|
||||
:ivar bar: great stuff
|
||||
:type bar: string
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
def func(fo<caret>o):
|
||||
""" \\some comment
|
||||
@param foo: The parameter value.
|
||||
@type foo: Its type."""
|
||||
pass
|
||||
@@ -1,5 +0,0 @@
|
||||
def func(bar):
|
||||
""" \\some comment
|
||||
@param bar: The parameter value.
|
||||
@type bar: Its type."""
|
||||
pass
|
||||
@@ -1,9 +0,0 @@
|
||||
class <caret>Xyzzy:
|
||||
pass
|
||||
|
||||
def foo(p):
|
||||
"""
|
||||
@param p: the magic word
|
||||
@type p: Xyzzy
|
||||
@return:
|
||||
"""
|
||||
@@ -1,9 +0,0 @@
|
||||
class Shazam:
|
||||
pass
|
||||
|
||||
def foo(p):
|
||||
"""
|
||||
@param p: the magic word
|
||||
@type p: Shazam
|
||||
@return:
|
||||
"""
|
||||
@@ -0,0 +1,5 @@
|
||||
def func(fo<caret>o):
|
||||
""" \\some comment
|
||||
:param foo: The parameter value.
|
||||
:type foo: Its type."""
|
||||
pass
|
||||
@@ -0,0 +1,5 @@
|
||||
def func(bar):
|
||||
""" \\some comment
|
||||
:param bar: The parameter value.
|
||||
:type bar: Its type."""
|
||||
pass
|
||||
9
python/testData/refactoring/rename/restRenameType.py
Normal file
9
python/testData/refactoring/rename/restRenameType.py
Normal file
@@ -0,0 +1,9 @@
|
||||
class <caret>Xyzzy:
|
||||
pass
|
||||
|
||||
def foo(p):
|
||||
"""
|
||||
:param p: the magic word
|
||||
:type p: Xyzzy
|
||||
:return:
|
||||
"""
|
||||
@@ -0,0 +1,9 @@
|
||||
class Shazam:
|
||||
pass
|
||||
|
||||
def foo(p):
|
||||
"""
|
||||
:param p: the magic word
|
||||
:type p: Shazam
|
||||
:return:
|
||||
"""
|
||||
@@ -1,8 +0,0 @@
|
||||
class MyClass:
|
||||
"""
|
||||
@type attr: str
|
||||
<ref>
|
||||
"""
|
||||
|
||||
def m(self):
|
||||
self.attr = 'foo'
|
||||
@@ -1,154 +0,0 @@
|
||||
// Copyright 2000-2021 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.jetbrains.python.documentation.docstrings.EpydocString;
|
||||
import com.jetbrains.python.toolbox.Substring;
|
||||
import junit.framework.TestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.testFramework.UsefulTestCase.assertOrderedEquals;
|
||||
import static com.intellij.testFramework.UsefulTestCase.assertSameElements;
|
||||
|
||||
|
||||
public class EpydocStringTest extends TestCase {
|
||||
public void testTagValue() {
|
||||
EpydocString docString = createEpydocDocString("@rtype: C{str}");
|
||||
Substring s = docString.getTagValue("rtype");
|
||||
assertNotNull(s);
|
||||
assertEquals("C{str}", s.toString());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private EpydocString createEpydocDocString(String s) {
|
||||
return new EpydocString(new Substring(s));
|
||||
}
|
||||
|
||||
public void testTagWithParamValue() {
|
||||
EpydocString docString = createEpydocDocString("@type m: number");
|
||||
final Substring s = docString.getTagValue("type", "m");
|
||||
assertNotNull(s);
|
||||
assertEquals("number", s.toString());
|
||||
}
|
||||
|
||||
public void testMultilineTag() {
|
||||
EpydocString docString = createEpydocDocString(" @param b: The y intercept of the line. The X{y intercept} of a\n" +
|
||||
" line is the point at which it crosses the y axis (M{x=0}).");
|
||||
final Substring s = docString.getTagValue("param", "b");
|
||||
assertNotNull(s);
|
||||
assertEquals("The y intercept of the line. The X{y intercept} of a line is the point at which it crosses the y axis (M{x=0}).",
|
||||
s.concatTrimmedLines(" "));
|
||||
|
||||
}
|
||||
|
||||
public void testInlineMarkup() {
|
||||
assertEquals("The y intercept of the line. The y intercept of a line is the point at which it crosses the y axis (x=0).",
|
||||
EpydocString.removeInlineMarkup("The y intercept of the line. The X{y intercept} of a line is the point at which it crosses the y axis (M{x=0})."));
|
||||
|
||||
}
|
||||
|
||||
public void testMultipleTags() {
|
||||
EpydocString docString = createEpydocDocString("""
|
||||
Run the given function wrapped with seteuid/setegid calls.
|
||||
|
||||
This will try to minimize the number of seteuid/setegid calls, comparing
|
||||
current and wanted permissions
|
||||
|
||||
@param euid: effective UID used to call the function.
|
||||
@type euid: C{int}
|
||||
|
||||
@param egid: effective GID used to call the function.
|
||||
@type egid: C{int}
|
||||
|
||||
@param function: the function run with the specific permission.
|
||||
@type function: any callable
|
||||
|
||||
@param *args: arguments passed to function
|
||||
@param **kwargs: keyword arguments passed to C{function}
|
||||
\s
|
||||
@return: the return value of the function\
|
||||
""");
|
||||
|
||||
final List<String> params = docString.getParameters();
|
||||
assertOrderedEquals(params, "euid", "egid", "function", "*args", "**kwargs");
|
||||
assertEquals("effective UID used to call the function.", docString.getParamDescription("euid"));
|
||||
assertEquals("effective GID used to call the function.", docString.getParamDescription("egid"));
|
||||
assertEquals("arguments passed to function", docString.getParamDescription("args"));
|
||||
assertEquals("the return value of the function", docString.getReturnDescription());
|
||||
}
|
||||
|
||||
public void testInlineMarkupToHTML() {
|
||||
assertEquals("can contain <i>inline markup</i> and <b>bold text</b>", EpydocString.inlineMarkupToHTML("can contain I{inline markup} and B{bold text}"));
|
||||
}
|
||||
|
||||
public void testCodeToHTML() {
|
||||
assertEquals("<code>my_dict={1:2, 3:4}</code>", EpydocString.inlineMarkupToHTML("C{my_dict={1:2, 3:4}}"));
|
||||
}
|
||||
|
||||
public void testUrlToHTML() {
|
||||
assertEquals("<a href=\"http://www.python.org\">www.python.org</a>", EpydocString.inlineMarkupToHTML("U{www.python.org}"));
|
||||
assertEquals("<a href=\"http://www.python.org\">www.python.org</a>", EpydocString.inlineMarkupToHTML("U{www.python.org}"));
|
||||
assertEquals("<a href=\"http://epydoc.sourceforge.net\">The epydoc homepage</a>",
|
||||
EpydocString.inlineMarkupToHTML("U{The epydoc homepage<http://\n" +
|
||||
" epydoc.sourceforge.net>}"));
|
||||
}
|
||||
|
||||
public void testNestedInlineMarkup() {
|
||||
assertEquals("<i><b>Inline markup</b> may be nested; and it may span</i> multiple lines.",
|
||||
EpydocString.inlineMarkupToHTML("I{B{Inline markup} may be nested; and\n" +
|
||||
" it may span} multiple lines."));
|
||||
|
||||
}
|
||||
|
||||
public void testParagraph() {
|
||||
assertEquals("foo<p>bar", EpydocString.inlineMarkupToHTML("foo\n\nbar"));
|
||||
}
|
||||
|
||||
public void testRemoveNestedInlineMarkup() {
|
||||
assertEquals("(ParsedDocstring, list of Field)",
|
||||
EpydocString.removeInlineMarkup("C{(L{ParsedDocstring}, list of L{Field})}"));
|
||||
}
|
||||
|
||||
public void testDifferentExceptionTags() {
|
||||
final EpydocString docstring = createEpydocDocString("@raises Exception1: foo\n" +
|
||||
"@except Exception2: bar");
|
||||
assertSameElements(docstring.getRaisedExceptions(), "Exception1", "Exception2");
|
||||
assertEquals("foo", docstring.getRaisedExceptionDescription("Exception1"));
|
||||
assertEquals("bar", docstring.getRaisedExceptionDescription("Exception2"));
|
||||
}
|
||||
|
||||
public void testFieldAliases() {
|
||||
final EpydocString docstring = createEpydocDocString("""
|
||||
@param p1: p1 description
|
||||
@parameter p2: p2 description
|
||||
@arg p3: p3 description
|
||||
@argument p4: p4 description
|
||||
|
||||
@kwarg key1: key1 description
|
||||
@keyword key2: key2 description
|
||||
@kwparam key3: key3 description
|
||||
|
||||
@raises Exc1: Exc1 description \s
|
||||
@raise Exc2: Exc2 description\s
|
||||
@except Exc3: Exc3 description\s
|
||||
@exception Exc4: Exc4 description\s""");
|
||||
|
||||
assertSameElements(docstring.getParameters(), "p1", "p2", "p3", "p4");
|
||||
assertEquals("p1 description", docstring.getParamDescription("p1"));
|
||||
assertEquals("p2 description", docstring.getParamDescription("p2"));
|
||||
assertEquals("p3 description", docstring.getParamDescription("p3"));
|
||||
assertEquals("p4 description", docstring.getParamDescription("p4"));
|
||||
|
||||
assertSameElements(docstring.getKeywordArguments(), "key1", "key2", "key3");
|
||||
assertEquals("key1 description", docstring.getKeywordArgumentDescription("key1"));
|
||||
assertEquals("key2 description", docstring.getKeywordArgumentDescription("key2"));
|
||||
assertEquals("key3 description", docstring.getKeywordArgumentDescription("key3"));
|
||||
|
||||
assertSameElements(docstring.getRaisedExceptions(), "Exc1", "Exc2", "Exc3", "Exc4");
|
||||
assertEquals("Exc1 description", docstring.getRaisedExceptionDescription("Exc1"));
|
||||
assertEquals("Exc2 description", docstring.getRaisedExceptionDescription("Exc2"));
|
||||
assertEquals("Exc3 description", docstring.getRaisedExceptionDescription("Exc3"));
|
||||
assertEquals("Exc4 description", docstring.getRaisedExceptionDescription("Exc4"));
|
||||
}
|
||||
}
|
||||
@@ -512,11 +512,7 @@ public class Py3QuickDocTest extends LightMarkedTestCase {
|
||||
checkHTMLOnly();
|
||||
}
|
||||
|
||||
public void testParamDescriptionEpytext() {
|
||||
checkHTMLOnly();
|
||||
}
|
||||
|
||||
public void testParamAndReturnValueDescriptionNoTagsEpytext() {
|
||||
public void testParamAndReturnValueDescriptionNoTagsRest() {
|
||||
checkHTMLOnly();
|
||||
}
|
||||
|
||||
@@ -532,11 +528,6 @@ public class Py3QuickDocTest extends LightMarkedTestCase {
|
||||
checkHTMLOnly();
|
||||
}
|
||||
|
||||
// PY-11425
|
||||
public void testKeywordArgsDescriptionEpydoc() {
|
||||
checkHTMLOnly();
|
||||
}
|
||||
|
||||
public void testKeywordArgsDescriptionGoogle() {
|
||||
checkHTMLOnly();
|
||||
}
|
||||
@@ -721,11 +712,6 @@ public class Py3QuickDocTest extends LightMarkedTestCase {
|
||||
runWithDocStringFormat(DocStringFormat.REST, () -> checkHTMLOnly());
|
||||
}
|
||||
|
||||
// PY-33341
|
||||
public void testClassAndInstanceAttributesInOneSectionEpydoc() {
|
||||
runWithDocStringFormat(DocStringFormat.EPYTEXT, () -> checkHTMLOnly());
|
||||
}
|
||||
|
||||
// PY-33341
|
||||
public void testAttributesOrderGoogle() {
|
||||
checkHTMLOnly();
|
||||
|
||||
@@ -555,19 +555,19 @@ public class PyQuickFixTest extends PyTestCase {
|
||||
// PY-3394
|
||||
public void testDocstringParams() {
|
||||
getIndentOptions().INDENT_SIZE = 2;
|
||||
runWithDocStringFormat(DocStringFormat.EPYTEXT,
|
||||
runWithDocStringFormat(DocStringFormat.REST,
|
||||
() -> doInspectionTest(PyIncorrectDocstringInspection.class, PyPsiBundle.message("QFIX.docstring.add.parameter", "b"), true, true));
|
||||
}
|
||||
|
||||
public void testDocstringParams1() {
|
||||
getIndentOptions().INDENT_SIZE = 2;
|
||||
runWithDocStringFormat(DocStringFormat.EPYTEXT,
|
||||
runWithDocStringFormat(DocStringFormat.REST,
|
||||
() -> doInspectionTest(PyIncorrectDocstringInspection.class, PyPsiBundle.message("QFIX.docstring.remove.parameter", "c"), true, true));
|
||||
}
|
||||
|
||||
// PY-4964
|
||||
public void testDocstringParams2() {
|
||||
runWithDocStringFormat(DocStringFormat.EPYTEXT,
|
||||
runWithDocStringFormat(DocStringFormat.REST,
|
||||
() -> doInspectionTest(PyIncorrectDocstringInspection.class, PyPsiBundle.message("QFIX.docstring.add.parameter", "ham"), true, true));
|
||||
}
|
||||
|
||||
|
||||
@@ -229,22 +229,6 @@ public class PySmartEnterTest extends PyTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testDocEpytext() {
|
||||
CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
|
||||
boolean oldStubOnEnter = codeInsightSettings.JAVADOC_STUB_ON_ENTER;
|
||||
codeInsightSettings.JAVADOC_STUB_ON_ENTER = true;
|
||||
PyDocumentationSettings documentationSettings = PyDocumentationSettings.getInstance(myFixture.getModule());
|
||||
documentationSettings.setFormat(DocStringFormat.EPYTEXT);
|
||||
try {
|
||||
doTest();
|
||||
}
|
||||
finally {
|
||||
documentationSettings.setFormat(DocStringFormat.PLAIN);
|
||||
codeInsightSettings.JAVADOC_STUB_ON_ENTER = oldStubOnEnter;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void testDocTypeRType() {
|
||||
CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
|
||||
boolean oldStubOnEnter = codeInsightSettings.JAVADOC_STUB_ON_ENTER;
|
||||
@@ -253,7 +237,7 @@ public class PySmartEnterTest extends PyTestCase {
|
||||
boolean oldInsertType = pyCodeInsightSettings.INSERT_TYPE_DOCSTUB;
|
||||
pyCodeInsightSettings.INSERT_TYPE_DOCSTUB = true;
|
||||
PyDocumentationSettings documentationSettings = PyDocumentationSettings.getInstance(myFixture.getModule());
|
||||
documentationSettings.setFormat(DocStringFormat.EPYTEXT);
|
||||
documentationSettings.setFormat(DocStringFormat.REST);
|
||||
try {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@@ -213,32 +213,6 @@ public class PyTypeTest extends PyTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
public void testEpydocReturnType() {
|
||||
doTest("str",
|
||||
"""
|
||||
def foo(*args):
|
||||
'''@rtype: C{str}'''
|
||||
return args[0]expr = foo('')""");
|
||||
}
|
||||
|
||||
public void testEpydocParamType() {
|
||||
doTest("str",
|
||||
"""
|
||||
def foo(s):
|
||||
'''@type s: C{str}'''
|
||||
expr = s""");
|
||||
}
|
||||
|
||||
public void testEpydocIvarType() {
|
||||
doTest("int",
|
||||
"""
|
||||
class C:
|
||||
s = None
|
||||
'''@type: C{int}'''
|
||||
def foo(self):
|
||||
expr = self.s""");
|
||||
}
|
||||
|
||||
public void testRestParamType() {
|
||||
doTest("int",
|
||||
"""
|
||||
|
||||
@@ -100,7 +100,7 @@ public class PythonInspectionsTest extends PyTestCase {
|
||||
|
||||
//PY-3373
|
||||
public void testPyDocstringParametersInspection() {
|
||||
runWithDocStringFormat(DocStringFormat.EPYTEXT, () -> doHighlightingTest(PyIncorrectDocstringInspection.class, LanguageLevel.PYTHON34));
|
||||
runWithDocStringFormat(DocStringFormat.REST, () -> doHighlightingTest(PyIncorrectDocstringInspection.class, LanguageLevel.PYTHON34));
|
||||
}
|
||||
|
||||
// PY-9795
|
||||
|
||||
@@ -81,11 +81,11 @@ public class PyRenameTest extends PyTestCase {
|
||||
doTest("bar");
|
||||
}
|
||||
|
||||
public void testEpydocRenameParameter() {
|
||||
public void testRestRenameParameter() {
|
||||
doTest("bar");
|
||||
}
|
||||
|
||||
public void testEpydocRenameType() {
|
||||
public void testRestRenameType() {
|
||||
doTest("Shazam");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user