Merge "-builtin" autodoc bugs workarounds from master into test.

Although some of the bugs (e.g. missing "self") in the autodoc doc strings
when using "-builtin" option were fixed in the Doxygen branch, others are
still present, so we still need to skip some of the tests in "-builtin" case.
This commit is contained in:
Vadim Zeitlin 2015-07-20 16:17:06 +02:00
commit e191360c9f
2 changed files with 32 additions and 12 deletions

View file

@ -1,7 +1,14 @@
from autodoc import *
from commentVerifier import check
import commentVerifier
import sys
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
commentVerifier.check(got, expect)
def is_new_style_class(cls):
return hasattr(cls, "__class__")
@ -10,7 +17,10 @@ if not is_new_style_class(A):
# used!
sys.exit(0)
check(A.__doc__, "Proxy of C++ A class")
# skip builtin check - the autodoc is missing, but it probably should not be
skip = True
check(A.__doc__, "Proxy of C++ A class", "::A")
check(A.funk.__doc__, "just a string")
check(A.func0.__doc__, "func0(self, arg2, hello) -> int")
check(A.func1.__doc__, "func1(A self, short arg2, Tuple hello) -> int")
@ -114,34 +124,43 @@ check(A.func3static.__doc__,
if sys.version_info[0:2] > (2, 4):
# Python 2.4 does not seem to work
check(A.variable_a.__doc__,
"A_variable_a_get(self) -> int"
"A_variable_a_get(self) -> int",
"A.variable_a"
)
check(A.variable_b.__doc__,
"A_variable_b_get(A self) -> int"
"A_variable_b_get(A self) -> int",
"A.variable_b"
)
check(A.variable_c.__doc__,
"A_variable_c_get(self) -> int\n"
"\n"
"Parameters:\n"
" self: A *\n"
" self: A *\n",
"A.variable_c"
)
check(A.variable_d.__doc__,
"A_variable_d_get(A self) -> int\n"
"\n"
"Parameters:\n"
" self: A *\n"
" self: A *\n",
"A.variable_d"
)
check(B.__doc__, "Proxy of C++ B class")
check(C.__init__.__doc__, "__init__(self, a, b, h) -> C")
check(D.__init__.__doc__, "__init__(D self, int a, int b, Hola h) -> D")
check(B.__doc__,
"Proxy of C++ B class",
"::B"
)
check(C.__init__.__doc__, "__init__(self, a, b, h) -> C", None, skip)
check(D.__init__.__doc__,
"__init__(D self, int a, int b, Hola h) -> D", None, skip)
check(E.__init__.__doc__,
"__init__(self, a, b, h) -> E\n"
"\n"
"Parameters:\n"
" a: special comment for parameter a\n"
" b: another special comment for parameter b\n"
" h: enum Hola\n"
" h: enum Hola\n",
None, skip
)
check(F.__init__.__doc__,
"__init__(F self, int a, int b, Hola h) -> F\n"
@ -149,7 +168,8 @@ check(F.__init__.__doc__,
"Parameters:\n"
" a: special comment for parameter a\n"
" b: another special comment for parameter b\n"
" h: enum Hola\n"
" h: enum Hola\n",
None, skip
)
check(B.funk.__doc__, "funk(B self, int c, int d) -> int")

View file

@ -1,4 +1,4 @@
def check(got, expected):
def check(got, expected, expected_builtin=None):
if got is None: # Absence of comment is equivalent to empty comment.
got = ''