def check(got, expected, expected_builtin=None, skip=False): if is_python_builtin() and skip: # Only skip for builtins pass else: expect = expected if is_python_builtin() and expected_builtin != None: expect = expected_builtin comment_verifier.check(got, expect)
def check(got, expected, expected_builtin=None, skip=False): if is_python_builtin() and skip: # Only skip for builtins pass else: expect = expected if is_python_builtin() and expected_builtin != None: expect = expected_builtin comment_verifier.check(got, expect)
import doxygen_parsing import inspect import string import os import sys import comment_verifier comment_verifier.check(inspect.getdoc(doxygen_parsing.someFunction), "The function comment") comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeClass), "The class comment") comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeStruct), "The struct comment") # There doesn't seem to be any way to specify the doc string for __init__ when # using "-builtin" (see http://stackoverflow.com/q/11913492/15275), so skip # this test in this case. if str(os.environ.get('SWIG_FEATURES')).find('-builtin') == -1: comment_verifier.check( inspect.getdoc(doxygen_parsing.SomeAnotherClass.__init__), r"""*Overload 1:* First overloaded constructor. | *Overload 2:* Second overloaded constructor.""") comment_verifier.check( inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMethod), r"""The class method comment.
import doxygen_parsing import inspect import string import os import sys import comment_verifier comment_verifier.check(inspect.getdoc(doxygen_parsing.someFunction), "The function comment") comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeClass), "The class comment") comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeStruct), "The struct comment") comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass), "SomeAnotherClass description") # There doesn't seem to be any way to specify the doc string for __init__ when # using "-builtin" (see http://stackoverflow.com/q/11913492/15275), so skip # this test in this case. if not doxygen_parsing.is_python_builtin(): comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.__init__), r"""*Overload 1:* First overloaded constructor. | *Overload 2:* Second overloaded constructor.""") comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMethod), r"""The class method comment.
def check(got, expected, expected_builtin=None, skip=False): if not skip: expect = expected if is_python_builtin() and expected_builtin != None: expect = expected_builtin comment_verifier.check(got, expect)
import doxygen_ignore import inspect import comment_verifier comment_verifier.check( inspect.getdoc(doxygen_ignore.func), """\ A contrived example of ignoring too many commands in one comment. This is specific to **Python**. Command ignored, but anything here is still included.""")
import doxygen_basic_translate import inspect import string import sys import comment_verifier comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function), """\ Brief description. The comment text. Author: Some author :rtype: int :return: Some number See also: function2""" ) comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function2), """\ A test of a very very very very very very very very very very very very very very very very very very very very very long comment string.""" ) comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function3), """*Overload 1:* A test for overloaded functions This is function **one** |
comment_verifier.check(inspect.getdoc(doxygen_translate_links.function), r"""Testing typenames converting in @ link superFunc(int,std::string) Test for std_string member superFunc(int,long,void*) Test for simple types superFunc(Shape::superType*) Test for custom types superFunc(int**[13]) Test for complex types same works for 'See also:' links: See also: superFunc(int,std::string) See also: superFunc(int,long,void*) See also: superFunc(Shape::superType*) See also: superFunc(int**[13]) some failing params: See also: superFunc() See also: superFunc() See also: superFunc()""")
from doxygen_autodoc_docstring import * import inspect import string import os import sys import comment_verifier # documentation from autogenerated 'feature:autodoc' comment_verifier.check( inspect.getdoc(ClassWithoutDoxygenComment), "::ClassWithoutDoxygenComment" if is_python_builtin() else "Proxy of C++ ClassWithoutDoxygenComment class.") comment_verifier.check(inspect.getdoc(functionWithoutDoxygenComment), "functionWithoutDoxygenComment(int number)") # documentation from doxygen comments comment_verifier.check(inspect.getdoc(ClassWithDoxygenComment), "Class doxygen comment") comment_verifier.check(inspect.getdoc(functionWithDoxygenComment), "Function doxygen comment") # documentation from 'feature:docstring' comment_verifier.check(inspect.getdoc(ClassWithDocString), "Class doc from docstring") comment_verifier.check( inspect.getdoc(functionWithDocString), "functionWithDocString(int number)\n" "Function doc from docstring") # documentation from 'feature:docstring' + autodoc (overriding doxycomment) comment_verifier.check(inspect.getdoc(ClassWithDocStringAndDoxygenComment),
import doxygen_ignore import inspect import comment_verifier comment_verifier.check(inspect.getdoc(doxygen_ignore.func), """\ A contrived example of ignoring too many commands in one comment. This is specific to **Python**. Command ignored, but anything here is still included.""")
import doxygen_basic_notranslate import inspect import string import sys import comment_verifier comment_verifier.check( inspect.getdoc(doxygen_basic_notranslate.function), r"""\brief Brief description. The comment text \author Some author \return Some number \sa function2""") comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function1), r"""Single line comment """) comment_verifier.check( inspect.getdoc(doxygen_basic_notranslate.function2), r"""A test of a very very very very very very very very very very very very very very very very very very very very very long comment string.""") comment_verifier.check( inspect.getdoc(doxygen_basic_notranslate.function3), r"""*Overload 1:* A test for overloaded functions This is function \b one | *Overload 2:*
comment_verifier.check( inspect.getdoc(doxygen_translate_links.function), r"""Testing typenames converting in @ link superFunc(int,std::string) Test for std_string member superFunc(int,long,void*) Test for simple types superFunc(Shape::superType*) Test for custom types superFunc(int**[13]) Test for complex types same works for 'See also:' links: See also: superFunc(int,std::string) See also: superFunc(int,long,void*) See also: superFunc(Shape::superType*) See also: superFunc(int**[13]) some failing params: See also: superFunc() See also: superFunc() See also: superFunc()""")
import doxygen_alias import inspect import comment_verifier comment_verifier.check(inspect.getdoc(doxygen_alias.make_something), """\ A function returning something. :rtype: :py:class:`Something` :return: A new object which may be None.""")
import doxygen_alias import inspect import comment_verifier comment_verifier.check( inspect.getdoc(doxygen_alias.make_something), """\ A function returning something. :rtype: :py:class:`Something` :return: A new object which may be None.""")
def check(got, expected, expected_builtin=None, skip=False): if not skip: expect = expected if is_python_builtin() and expected_builtin != None: expect = expected_builtin comment_verifier.check(got, expect)
comment_verifier.check( inspect.getdoc(doxygen_code_blocks.function), """\ Test for code blocks .. code-block:: c++ simple code block More advanced usage with C++ characters: .. code-block:: c++ std::vector<int> first; // empty vector of ints std::vector<int> second (4,100); // four ints with value 100 std::vector<int> third (second.begin(),second.end()); // iterating through second std::vector<int> fourth (third); // a copy of third // the iterator constructor can also be used to construct from arrays: int myints[] = {16,2,77,29}; std::vector<int> fifth (myints, myints + sizeof(myints) / sizeof(int) ); std::cout << "The contents of fifth are:"; for (std::vector<int>::iterator it = fifth.begin(); it != fifth.end(); ++it) std::cout << ' ' << *it; std::cout << '\\n'; A code block for C: .. code-block:: c printf("hello world"); A code block for Java: .. code-block:: java public class HelloWorld { public static void main(String[] args) { // Prints "Hello, World" to the terminal window. System.out.println("Hello, World"); } } A code block for python: .. code-block:: python print('hello world') A python doctest example: >>> 1 + 1 2""")
comment_verifier.check(inspect.getdoc(doxygen_translate.function), r"""*Hello* * some list item Authors: lots of them Author: Zubr **boldword** ``codeword`` 'citationword' .. code-block:: c++ some test code Conditional comment: SOMECONDITION Some conditional comment End of conditional comment. Copyright: some copyright Deprecated: Now use another function *italicword* Example: someFile.txt Some details on using the example :raises: SuperError If: ANOTHERCONDITION { First part of comment If: SECONDCONDITION { Nested condition text }Else if: THIRDCONDITION { The third condition text }Else: { The last text block } }Else: { Second part of comment If: CONDITION { Second part extended } } If not: SOMECONDITION { This is printed if not } Image: testImage.bmp("Hello, world!") * Some unordered list * With lots of items * lots of lots of items someMember Some description follows Notes: Here is the note! This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. someword Title: The paragraph title The paragraph text. Maybe even multiline :type a: int :param a: the first param Remarks: Some remark text Another remarks section :rtype: int :return: Whatever :rtype: int :return: it :rtype: int :return: may return See also: someOtherMethod See also: function Since: version 0.0.0.1 :raises: superException :raises: RuntimeError TODO: Some very important task :type b: float :param b: B is mentioned again... very long text with tags <sometag> Version: 0.0.0.2 Warning: This is senseless! Here goes test of symbols: $ @ \ & ~ < > # % " . :: And here goes simple text""" )
import doxygen_basic_notranslate import inspect import string import sys import comment_verifier comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function), r"""\brief Brief description. The comment text \author Some author \return Some number \sa function2""" ) comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function1), r"""Single line comment """ ) comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function2), r"""A test of a very very very very very very very very very very very very very very very very very very very very very long comment string.""" ) comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function3), r"""*Overload 1:* A test for overloaded functions This is function \b one |
comment_verifier.check( inspect.getdoc(doxygen_translate.function), r"""*Hello* * some list item Authors: lots of them Author: Zubr **boldword** ``codeword`` 'citationword' .. code-block:: c++ some test code Conditional comment: SOMECONDITION Some conditional comment End of conditional comment. Copyright: some copyright Deprecated: Now use another function *italicword* Example: someFile.txt Some details on using the example :raises: SuperError If: ANOTHERCONDITION { First part of comment If: SECONDCONDITION { Nested condition text }Else if: THIRDCONDITION { The third condition text }Else: { The last text block } }Else: { Second part of comment If: CONDITION { Second part extended } } If not: SOMECONDITION { This is printed if not } Image: testImage.bmp("Hello, world!") * Some unordered list * With lots of items * lots of lots of items someMember Some description follows Notes: Here is the note! This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. ``someword`` Title: The paragraph title The paragraph text. Maybe even multiline :type a: int :param a: the first param Remarks: Some remark text Another remarks section :rtype: int :return: Whatever :rtype: int :return: it :rtype: int :return: may return See also: someOtherMethod See also: function Since: version 0.0.0.1 :raises: superException :raises: RuntimeError TODO: Some very important task :type b: float :param b: B is mentioned again... very long text with tags <sometag> Version: 0.0.0.2 Warning: This is senseless! Here goes test of symbols: $ @ \ & ~ < > # % " . :: And here goes simple text""")
comment_verifier.check( inspect.getdoc(doxygen_translate_all_tags.func01), r"""*Hello* * some list item This is attention! You were warned! Authors: lots of them Author: Zubr **boldword** Some brief description, extended to many lines. Not everything works right now... ``codeword`` 'citationword' .. code-block:: c++ some test code Code immediately following text. Pydoc translation must add an empty line before: .. code-block:: c++ more test code""")
import doxygen_misc_constructs import inspect import string import sys import comment_verifier comment_verifier.check( inspect.getdoc(doxygen_misc_constructs.getAddress), r"""Returns address of file line. :type fileName: int :param fileName: name of the file, where the source line is located :type line: int :param line: line number :type isGetSize: boolean, optional :param isGetSize: if set, for every object location both address and size are returned Connection::getId() """) comment_verifier.check( inspect.getdoc(doxygen_misc_constructs.CConnectionConfig), r"""This class contains information for connection to winIDEA. Its methods return reference to self, so we can use it like this: CConnectionConfig config = new CConnectionConfig(); config.discoveryPort(5534).dllPath("C:\\myWinIDEA\\connect.dll").id("main"); All parameters are optional. Set only what is required, default values are used for unspecified parameters.
comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func01), r"""*Hello* * some list item This is attention! You were warned! Authors: lots of them Author: Zubr **boldword** Some brief description, extended to many lines. Not everything works right now... ``codeword`` 'citationword' .. code-block:: c++ some test code""")