Search in sources :

Example 1 with EpydocString

use of com.jetbrains.python.documentation.docstrings.EpydocString in project intellij-community by JetBrains.

the class EpydocStringTest method testTagWithParamValue.

public void testTagWithParamValue() {
    EpydocString docString = createEpydocDocString("@type m: number");
    final Substring s = docString.getTagValue("type", "m");
    assertNotNull(s);
    assertEquals("number", s.toString());
}
Also used : Substring(com.jetbrains.python.toolbox.Substring) EpydocString(com.jetbrains.python.documentation.docstrings.EpydocString)

Example 2 with EpydocString

use of com.jetbrains.python.documentation.docstrings.EpydocString in project intellij-community by JetBrains.

the class EpydocStringTest method testMultilineTag.

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(" "));
}
Also used : Substring(com.jetbrains.python.toolbox.Substring) EpydocString(com.jetbrains.python.documentation.docstrings.EpydocString)

Example 3 with EpydocString

use of com.jetbrains.python.documentation.docstrings.EpydocString in project intellij-community by JetBrains.

the class EpydocStringTest method testTagValue.

public void testTagValue() {
    EpydocString docString = createEpydocDocString("@rtype: C{str}");
    Substring s = docString.getTagValue("rtype");
    assertNotNull(s);
    assertEquals("C{str}", s.toString());
}
Also used : Substring(com.jetbrains.python.toolbox.Substring) EpydocString(com.jetbrains.python.documentation.docstrings.EpydocString)

Example 4 with EpydocString

use of com.jetbrains.python.documentation.docstrings.EpydocString in project intellij-community by JetBrains.

the class EpydocStringTest method testMultipleTags.

public void testMultipleTags() {
    EpydocString docString = createEpydocDocString("    \"\"\"\n" + "    Run the given function wrapped with seteuid/setegid calls.\n" + "\n" + "    This will try to minimize the number of seteuid/setegid calls, comparing\n" + "    current and wanted permissions\n" + "\n" + "    @param euid: effective UID used to call the function.\n" + "    @type  euid: C{int}\n" + "\n" + "    @param egid: effective GID used to call the function.\n" + "    @type  egid: C{int}\n" + "\n" + "    @param function: the function run with the specific permission.\n" + "    @type  function: any callable\n" + "\n" + "    @param *args: arguments passed to function\n" + "    @param **kwargs: keyword arguments passed to C{function}\n" + "    \"\"\"");
    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"));
}
Also used : EpydocString(com.jetbrains.python.documentation.docstrings.EpydocString) EpydocString(com.jetbrains.python.documentation.docstrings.EpydocString)

Aggregations

EpydocString (com.jetbrains.python.documentation.docstrings.EpydocString)4 Substring (com.jetbrains.python.toolbox.Substring)3