Merge latest master into doxygen branch.

This commit is contained in:
Vadim Zeitlin 2014-12-15 02:54:57 +01:00
commit 9b857e6cf1
275 changed files with 6821 additions and 2094 deletions

View file

@ -39,7 +39,6 @@ CPP_TEST_CASES += \
inout \
inplaceadd \
input \
kwargs_feature \
li_cstring \
li_cwstring \
li_factory \
@ -86,19 +85,6 @@ C_TEST_CASES += \
include $(srcdir)/../common.mk
BUILTIN_BROKEN = \
default_constructor.cpptest \
director_exception.cpptest \
exception_order.cpptest \
li_std_string_extra.cpptest \
li_std_wstring.cpptest \
python_abstractbase.cpptest \
threads_exception.cpptest
BUILTIN_NOT_BROKEN = $(filter-out $(BUILTIN_BROKEN),$(NOT_BROKEN_TEST_CASES))
builtin-check : $(BUILTIN_NOT_BROKEN)
# Overridden variables here
SCRIPTDIR = .
LIBS = -L.

View file

@ -2,12 +2,25 @@ from autodoc import *
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)
commentVerifier.check(A.__doc__, "Proxy of C++ A class")
commentVerifier.check(A.funk.__doc__, "just a string")
commentVerifier.check(A.func0.__doc__, "func0(self, arg2, hello) -> int")
commentVerifier.check(A.func1.__doc__, "func1(A self, short arg2, Tuple hello) -> int")
commentVerifier.check(A.func2.__doc__, "\n"
skip = True # skip builtin check - the autodoc is missing, but it probably should not be
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",
"func0(arg2, hello) -> int")
check(A.func1.__doc__,
"func1(A self, short arg2, Tuple hello) -> int",
"func1(short arg2, Tuple hello) -> int")
check(A.func2.__doc__,
"\n"
" func2(self, arg2, hello) -> int\n"
"\n"
" Parameters:\n"
@ -15,8 +28,15 @@ commentVerifier.check(A.func2.__doc__, "\n"
" hello: int tuple[2]\n"
"\n"
" "
,
"func2(arg2, hello) -> int\n"
"\n"
"Parameters:\n"
" arg2: short\n"
" hello: int tuple[2]\n"
)
commentVerifier.check(A.func3.__doc__, "\n"
check(A.func3.__doc__,
"\n"
" func3(A self, short arg2, Tuple hello) -> int\n"
"\n"
" Parameters:\n"
@ -24,19 +44,34 @@ commentVerifier.check(A.func3.__doc__, "\n"
" hello: int tuple[2]\n"
"\n"
" "
,
"func3(short arg2, Tuple hello) -> int\n"
"\n"
"Parameters:\n"
" arg2: short\n"
" hello: int tuple[2]\n"
)
commentVerifier.check(A.func0default.__doc__, "\n"
check(A.func0default.__doc__,
"\n"
" func0default(self, e, arg3, hello, f=2) -> int\n"
" func0default(self, e, arg3, hello) -> int\n"
" "
,
"func0default(e, arg3, hello, f=2) -> int\n"
"func0default(e, arg3, hello) -> int"
)
commentVerifier.check(A.func1default.__doc__, "\n"
check(A.func1default.__doc__,
"\n"
" func1default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
" func1default(A self, A e, short arg3, Tuple hello) -> int\n"
" "
,
"func1default(A e, short arg3, Tuple hello, double f=2) -> int\n"
"func1default(A e, short arg3, Tuple hello) -> int"
)
commentVerifier.check(A.func2default.__doc__, "\n"
check(A.func2default.__doc__,
"\n"
" func2default(self, e, arg3, hello, f=2) -> int\n"
"\n"
" Parameters:\n"
@ -53,8 +88,24 @@ commentVerifier.check(A.func2default.__doc__, "\n"
" hello: int tuple[2]\n"
"\n"
" "
,
"func2default(e, arg3, hello, f=2) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
"func2default(e, arg3, hello) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
)
commentVerifier.check(A.func3default.__doc__, "\n"
check(A.func3default.__doc__,
"\n"
" func3default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
"\n"
" Parameters:\n"
@ -71,19 +122,43 @@ commentVerifier.check(A.func3default.__doc__, "\n"
" hello: int tuple[2]\n"
"\n"
" "
,
"func3default(A e, short arg3, Tuple hello, double f=2) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
"func3default(A e, short arg3, Tuple hello) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
)
commentVerifier.check(A.func0static.__doc__, "\n"
check(A.func0static.__doc__,
"\n"
" func0static(e, arg2, hello, f=2) -> int\n"
" func0static(e, arg2, hello) -> int\n"
" "
,
"func0static(e, arg2, hello, f=2) -> int\n"
"func0static(e, arg2, hello) -> int"
)
commentVerifier.check(A.func1static.__doc__, "\n"
check(A.func1static.__doc__,
"\n"
" func1static(A e, short arg2, Tuple hello, double f=2) -> int\n"
" func1static(A e, short arg2, Tuple hello) -> int\n"
" "
,
"func1static(A e, short arg2, Tuple hello, double f=2) -> int\n"
"func1static(A e, short arg2, Tuple hello) -> int"
)
commentVerifier.check(A.func2static.__doc__, "\n"
check(A.func2static.__doc__,
"\n"
" func2static(e, arg2, hello, f=2) -> int\n"
"\n"
" Parameters:\n"
@ -100,8 +175,24 @@ commentVerifier.check(A.func2static.__doc__, "\n"
" hello: int tuple[2]\n"
"\n"
" "
,
"func2static(e, arg2, hello, f=2) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
"func2static(e, arg2, hello) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
)
commentVerifier.check(A.func3static.__doc__, "\n"
check(A.func3static.__doc__,
"\n"
" func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
"\n"
" Parameters:\n"
@ -118,29 +209,58 @@ commentVerifier.check(A.func3static.__doc__, "\n"
" hello: int tuple[2]\n"
"\n"
" "
,
"func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
"func3static(A e, short arg2, Tuple hello) -> int\n"
"\n"
"Parameters:\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
)
if sys.version_info[0:2] > (2, 4):
# Python 2.4 does not seem to work
commentVerifier.check(A.variable_a.__doc__, "A_variable_a_get(self) -> int")
commentVerifier.check(A.variable_b.__doc__, "A_variable_b_get(A self) -> int")
commentVerifier.check(A.variable_c.__doc__,
check(A.variable_a.__doc__,
"A_variable_a_get(self) -> int",
"A.variable_a"
)
check(A.variable_b.__doc__,
"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"
,
"A.variable_c"
)
commentVerifier.check(A.variable_d.__doc__,
check(A.variable_d.__doc__,
"A_variable_d_get(A self) -> int\n"
"\n"
"Parameters:\n"
" self: A *\n"
,
"A.variable_d"
)
commentVerifier.check(B.__doc__, "Proxy of C++ B class")
commentVerifier.check(C.__init__.__doc__, "__init__(self, a, b, h) -> C")
commentVerifier.check(D.__init__.__doc__, "__init__(D self, int a, int b, Hola h) -> D")
commentVerifier.check(E.__init__.__doc__, "\n"
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__,
"\n"
" __init__(self, a, b, h) -> E\n"
"\n"
" Parameters:\n"
@ -149,8 +269,10 @@ commentVerifier.check(E.__init__.__doc__, "\n"
" h: enum Hola\n"
"\n"
" "
, None, skip
)
commentVerifier.check(F.__init__.__doc__, "\n"
check(F.__init__.__doc__,
"\n"
" __init__(F self, int a, int b, Hola h) -> F\n"
"\n"
" Parameters:\n"
@ -159,14 +281,21 @@ commentVerifier.check(F.__init__.__doc__, "\n"
" h: enum Hola\n"
"\n"
" "
, None, skip
)
commentVerifier.check(B.funk.__doc__, "funk(B self, int c, int d) -> int")
commentVerifier.check(funk.__doc__, "funk(A e, short arg2, int c, int d) -> int")
commentVerifier.check(funkdefaults.__doc__, "\n"
check(B.funk.__doc__,
"funk(B self, int c, int d) -> int",
"funk(int c, int d) -> int")
check(funk.__doc__, "funk(A e, short arg2, int c, int d) -> int")
check(funkdefaults.__doc__,
"\n"
" funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\n"
" funkdefaults(A e, short arg2, int c, int d) -> int\n"
" "
,
"funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\n"
"funkdefaults(A e, short arg2, int c, int d) -> int"
)
commentVerifier.check(func_input.__doc__, "func_input(int * INPUT) -> int")

View file

@ -1,6 +1,13 @@
import cpp11_function_objects
import sys
class Test1(cpp11_function_objects.Test):
def __init__(self):
cpp11_function_objects.Test.__init__(self)
def __call__(self, a, b):
self.value = a * b
t = cpp11_function_objects.Test()
if t.value != 0:
raise RuntimeError("Runtime cpp11_function_objects failed. t.value should be 0, but is " + str(t.value))
@ -10,3 +17,7 @@ t(1,2) # adds numbers and sets value
if t.value != 3:
raise RuntimeError("Runtime cpp11_function_objects failed. t.value not changed - should be 3, but is " + str(t.value))
t2 = Test1()
a = cpp11_function_objects.testit1(t2, 4,3)
if a != 12:
raise RuntimeError("Runtime cpp11_function_objects failed. t.value not changed - should be 12, but is " + str(a))

View file

@ -0,0 +1,164 @@
from cpp11_strongly_typed_enumerations import *
def enumCheck(actual, expected):
if actual != expected:
raise RuntimeError("Enum value mismatch. Expected " + str(expected) + " Actual: " + str(actual))
return expected + 1
val = 0
val = enumCheck(Enum1_Val1, val)
val = enumCheck(Enum1_Val2, val)
val = enumCheck(Enum1_Val3, 13)
val = enumCheck(Enum1_Val4, val)
val = enumCheck(Enum1_Val5a, 13)
val = enumCheck(Enum1_Val6a, val)
val = 0
val = enumCheck(Enum2_Val1, val)
val = enumCheck(Enum2_Val2, val)
val = enumCheck(Enum2_Val3, 23)
val = enumCheck(Enum2_Val4, val)
val = enumCheck(Enum2_Val5b, 23)
val = enumCheck(Enum2_Val6b, val)
val = 0
val = enumCheck(Val1, val)
val = enumCheck(Val2, val)
val = enumCheck(Val3, 43)
val = enumCheck(Val4, val)
val = 0
val = enumCheck(Enum5_Val1, val)
val = enumCheck(Enum5_Val2, val)
val = enumCheck(Enum5_Val3, 53)
val = enumCheck(Enum5_Val4, val)
val = 0
val = enumCheck(Enum6_Val1, val)
val = enumCheck(Enum6_Val2, val)
val = enumCheck(Enum6_Val3, 63)
val = enumCheck(Enum6_Val4, val)
val = 0
val = enumCheck(Enum7td_Val1, val)
val = enumCheck(Enum7td_Val2, val)
val = enumCheck(Enum7td_Val3, 73)
val = enumCheck(Enum7td_Val4, val)
val = 0
val = enumCheck(Enum8_Val1, val)
val = enumCheck(Enum8_Val2, val)
val = enumCheck(Enum8_Val3, 83)
val = enumCheck(Enum8_Val4, val)
val = 0
val = enumCheck(Enum10_Val1, val)
val = enumCheck(Enum10_Val2, val)
val = enumCheck(Enum10_Val3, 103)
val = enumCheck(Enum10_Val4, val)
val = 0
val = enumCheck(Class1.Enum12_Val1, 1121)
val = enumCheck(Class1.Enum12_Val2, 1122)
val = enumCheck(Class1.Enum12_Val3, val)
val = enumCheck(Class1.Enum12_Val4, val)
val = enumCheck(Class1.Enum12_Val5c, 1121)
val = enumCheck(Class1.Enum12_Val6c, val)
val = 0
val = enumCheck(Class1.Val1, 1131)
val = enumCheck(Class1.Val2, 1132)
val = enumCheck(Class1.Val3, val)
val = enumCheck(Class1.Val4, val)
val = enumCheck(Class1.Val5d, 1131)
val = enumCheck(Class1.Val6d, val)
val = 0
val = enumCheck(Class1.Enum14_Val1, 1141)
val = enumCheck(Class1.Enum14_Val2, 1142)
val = enumCheck(Class1.Enum14_Val3, val)
val = enumCheck(Class1.Enum14_Val4, val)
val = enumCheck(Class1.Enum14_Val5e, 1141)
val = enumCheck(Class1.Enum14_Val6e, val)
# Requires nested class support to work
#val = 0
#val = enumCheck(Class1.Struct1.Enum12_Val1, 3121)
#val = enumCheck(Class1.Struct1.Enum12_Val2, 3122)
#val = enumCheck(Class1.Struct1.Enum12_Val3, val)
#val = enumCheck(Class1.Struct1.Enum12_Val4, val)
#val = enumCheck(Class1.Struct1.Enum12_Val5f, 3121)
#val = enumCheck(Class1.Struct1.Enum12_Val6f, val)
#
#val = 0
#val = enumCheck(Class1.Struct1.Val1, 3131)
#val = enumCheck(Class1.Struct1.Val2, 3132)
#val = enumCheck(Class1.Struct1.Val3, val)
#val = enumCheck(Class1.Struct1.Val4, val)
#
#val = 0
#val = enumCheck(Class1.Struct1.Enum14_Val1, 3141)
#val = enumCheck(Class1.Struct1.Enum14_Val2, 3142)
#val = enumCheck(Class1.Struct1.Enum14_Val3, val)
#val = enumCheck(Class1.Struct1.Enum14_Val4, val)
#val = enumCheck(Class1.Struct1.Enum14_Val5g, 3141)
#val = enumCheck(Class1.Struct1.Enum14_Val6g, val)
val = 0
val = enumCheck(Class2.Enum12_Val1, 2121)
val = enumCheck(Class2.Enum12_Val2, 2122)
val = enumCheck(Class2.Enum12_Val3, val)
val = enumCheck(Class2.Enum12_Val4, val)
val = enumCheck(Class2.Enum12_Val5h, 2121)
val = enumCheck(Class2.Enum12_Val6h, val)
val = 0
val = enumCheck(Class2.Val1, 2131)
val = enumCheck(Class2.Val2, 2132)
val = enumCheck(Class2.Val3, val)
val = enumCheck(Class2.Val4, val)
val = enumCheck(Class2.Val5i, 2131)
val = enumCheck(Class2.Val6i, val)
val = 0
val = enumCheck(Class2.Enum14_Val1, 2141)
val = enumCheck(Class2.Enum14_Val2, 2142)
val = enumCheck(Class2.Enum14_Val3, val)
val = enumCheck(Class2.Enum14_Val4, val)
val = enumCheck(Class2.Enum14_Val5j, 2141)
val = enumCheck(Class2.Enum14_Val6j, val)
# Requires nested class support to work
#val = 0
#val = enumCheck(Class2.Struct1.Enum12_Val1, 4121)
#val = enumCheck(Class2.Struct1.Enum12_Val2, 4122)
#val = enumCheck(Class2.Struct1.Enum12_Val3, val)
#val = enumCheck(Class2.Struct1.Enum12_Val4, val)
#val = enumCheck(Class2.Struct1.Enum12_Val5k, 4121)
#val = enumCheck(Class2.Struct1.Enum12_Val6k, val)
#
#val = 0
#val = enumCheck(Class2.Struct1.Val1, 4131)
#val = enumCheck(Class2.Struct1.Val2, 4132)
#val = enumCheck(Class2.Struct1.Val3, val)
#val = enumCheck(Class2.Struct1.Val4, val)
#val = enumCheck(Class2.Struct1.Val5l, 4131)
#val = enumCheck(Class2.Struct1.Val6l, val)
#
#val = 0
#val = enumCheck(Class2.Struct1.Enum14_Val1, 4141)
#val = enumCheck(Class2.Struct1.Enum14_Val2, 4142)
#val = enumCheck(Class2.Struct1.Enum14_Val3, val)
#val = enumCheck(Class2.Struct1.Enum14_Val4, val)
#val = enumCheck(Class2.Struct1.Enum14_Val5m, 4141)
#val = enumCheck(Class2.Struct1.Enum14_Val6m, val)
class1 = Class1()
enumCheck(class1.class1Test1(Enum1_Val5a), 13)
enumCheck(class1.class1Test2(Class1.Enum12_Val5c), 1121)
#enumCheck(class1.class1Test3(Class1.Struct1.Enum12_Val5f), 3121)
enumCheck(globalTest1(Enum1_Val5a), 13)
enumCheck(globalTest2(Class1.Enum12_Val5c), 1121)
#enumCheck(globalTest3(Class1.Struct1.Enum12_Val5f), 3121)

View file

@ -1,8 +1,10 @@
import _default_constructor
# This test is expected to fail with -builtin option.
# It uses the old static syntax (e.g., dc.new_A() rather than dc.A()),
# which is not provided with the -builtin option.
import _default_constructor
if _default_constructor.is_python_builtin():
exit(0)
dc = _default_constructor

View file

@ -68,14 +68,13 @@ if not ok:
# This is expected to fail with -builtin option
# Throwing builtin classes as exceptions not supported
try:
raise Exception2()
except Exception2:
pass
if not is_python_builtin():
try:
raise Exception2()
except Exception2:
pass
# This is expected to fail with -builtin option
# Throwing builtin classes as exceptions not supported
try:
raise Exception1()
except Exception1:
pass
try:
raise Exception1()
except Exception1:
pass

View file

@ -0,0 +1,5 @@
from director_keywords import *
f = Foo()
f.check_self(20)

View file

@ -0,0 +1,18 @@
import director_property
class PyFoo(director_property.Foo):
a = property(director_property.Foo.getA, director_property.Foo.setA)
def ping(self):
return "PyFoo::ping()"
foo = PyFoo()
foo.setA("BLABLA")
if foo.getA() != "BLABLA":
raise RuntimeError
foo.a = "BIBI"
if foo.a != "BIBI":
raise RuntimeError

View file

@ -2,6 +2,8 @@ from exception_order import *
# This test is expected to fail with -builtin option.
# Throwing builtin classes as exceptions not supported
if is_python_builtin():
exit(0)
a = A()

View file

@ -1,5 +1,10 @@
from import_nomodule import *
# This test is expected to fail with -builtin option.
# The base class is needed for the builtin class hierarchy
if is_python_builtin():
exit(0)
f = create_Foo()
test1(f,42)
delete_Foo(f)

View file

@ -44,10 +44,10 @@ if BarInt_sbar(b=2) != 3:
if templatedfunction(b=2) != 3:
raise RuntimeError
if foo(a=1,b=2) != 3:
if foo_fn(a=1,b=2) != 3:
raise RuntimeError
if foo(b=2) != 3:
if foo_fn(b=2) != 3:
raise RuntimeError

View file

@ -1,9 +1,19 @@
from li_std_except_as_class import *
# std::domain_error hierarchy
try: test_domain_error()
except domain_error: pass
try: test_domain_error()
except logic_error: pass
try: test_domain_error()
except exception: pass
# This test is expected to fail with -builtin option.
# Throwing builtin classes as exceptions not supported
if is_python_builtin():
try: test_domain_error()
except RuntimeError: pass
try: test_domain_error()
except RuntimeError: pass
try: test_domain_error()
except RuntimeError: pass
else:
# std::domain_error hierarchy
try: test_domain_error()
except domain_error: pass
try: test_domain_error()
except logic_error: pass
try: test_domain_error()
except exception: pass

View file

@ -56,14 +56,13 @@ if a + " world" != "hello world":
# This is expected to fail with -builtin option
# Reverse operators not supported in builtin types
if "hello" + b != "hello world":
raise RuntimeError, "bad string mapping"
if not li_std_string_extra.is_python_builtin():
if "hello" + b != "hello world":
raise RuntimeError, "bad string mapping"
# This is expected to fail with -builtin option
# Reverse operators not supported in builtin types
c = "hello" + b
if c.find_last_of("l") != 9:
raise RuntimeError, "bad string mapping"
c = "hello" + b
if c.find_last_of("l") != 9:
raise RuntimeError, "bad string mapping"
s = "hello world"

View file

@ -60,13 +60,14 @@ if a + " world" != "hello world":
raise RuntimeError("bad string mapping")
# This is expected to fail if -builtin is used
if "hello" + b != "hello world":
raise RuntimeError("bad string mapping")
# Reverse operators not supported in builtin types
if not li_std_wstring.is_python_builtin():
if "hello" + b != "hello world":
raise RuntimeError("bad string mapping")
# This is expected to fail if -builtin is used
c = "hello" + b
if c.find_last_of("l") != 9:
raise RuntimeError("bad string mapping")
c = "hello" + b
if c.find_last_of("l") != 9:
raise RuntimeError("bad string mapping")
s = "hello world"

View file

@ -3,6 +3,8 @@ from collections import *
# This is expected to fail with -builtin option
# Builtin types can't inherit from pure-python abstract bases
if is_python_builtin():
exit(0)
assert issubclass(Mapii, MutableMapping)
assert issubclass(Multimapii, MutableMapping)

View file

@ -1,11 +1,16 @@
from python_append import *
# test not relevant for -builtin
if is_python_builtin():
exit(0)
t=Test()
t.func()
t.static_func()
if grabpath() != os.path.dirname(mypath):
raise RuntimeError
raise RuntimeError("grabpath failed")
if grabstaticpath() != os.path.basename(mypath):
raise RuntimeError
raise RuntimeError("grabstaticpath failed")

View file

@ -0,0 +1,10 @@
from python_threads import *
action = ActionGroup()
count = 1
for child in action.GetActionList():
if child.val != count:
raise RuntimeError("Expected: " + str(count) + " got: " + str(child.val))
count = count + 1
# Was seg faulting at the end here

View file

@ -20,15 +20,16 @@ except RuntimeError,e:
# This is expected fail with -builtin option
# Throwing builtin classes as exceptions not supported
try:
t.hosed()
except threads_exception.Exc,e:
code = e.code
if code != 42:
raise RuntimeError, "bad... code: %d" % code
msg = e.msg
if msg != "Hosed":
raise RuntimeError, "bad... msg: '%s' len: %d" % (msg, len(msg))
if not threads_exception.is_python_builtin():
try:
t.hosed()
except threads_exception.Exc,e:
code = e.code
if code != 42:
raise RuntimeError, "bad... code: %d" % code
msg = e.msg
if msg != "Hosed":
raise RuntimeError, "bad... msg: '%s' len: %d" % (msg, len(msg))
for i in range(1,4):
try: