Another merge with master.

Change Doxygen error codes to start at 740 instead of at 720 as the latter was
taken by Scilab in the meanwhile.

Resolve conflicts in autodoc_runme.py once again.
This commit is contained in:
Vadim Zeitlin 2015-02-16 23:46:39 +01:00
commit 300ccce46c
419 changed files with 18675 additions and 1315 deletions

View file

@ -11,6 +11,7 @@ endif
LANGUAGE = python
PYTHON = $(PYBIN)
PEP8 = @PEP8@
PEP8_FLAGS = --ignore=E402,E501,E30,W291,W391
#*_runme.py for Python 2.x, *_runme3.py for Python 3.x
PY2SCRIPTSUFFIX = _runme.py
@ -126,13 +127,13 @@ py3_runme = $(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX)
check_pep8 = \
if [ -n "$(PEP8)" ]; then \
$(PEP8) --ignore=E501,E30,W291,W391 $(SCRIPTPREFIX)$*.py;\
$(PEP8) $(PEP8_FLAGS) $(SCRIPTPREFIX)$*.py;\
fi
check_pep8_multi_cpp = \
if [ -n "$(PEP8)" ]; then \
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
$(PEP8) --ignore=E501,E30,W291,W391 $$f.py; \
$(PEP8) $(PEP8_FLAGS) $$f.py; \
done \
fi

View file

@ -2,6 +2,13 @@ from autodoc import *
from commentVerifier import check
import sys
def is_new_style_class(cls):
return hasattr(cls, "__class__")
if not is_new_style_class(A):
# Missing static methods make this hard to test... skip if -classic is used!
sys.exit(0)
check(A.__doc__, "Proxy of C++ A class")
check(A.funk.__doc__, "just a string")
check(A.func0.__doc__, "func0(self, arg2, hello) -> int")

View file

@ -0,0 +1,15 @@
import constant_directive
if not isinstance(constant_directive.TYPE1_CONSTANT1,constant_directive.Type1):
raise RuntimeError("Failure: TYPE1_CONSTANT1 type: {}".format(type(constant_directive.TYPE1_CONSTANT1)))
if not isinstance(constant_directive.getType1Instance(),constant_directive.Type1):
raise RuntimeError("Failure: getType1Instance() type: {}".format(type(constant_directive.getType1Instance())))
if constant_directive.TYPE1_CONSTANT1.val != 1:
raise RuntimeError("constant_directive.TYPE1_CONSTANT1.val is %r (should be 1)" % constant_directive.TYPE1_CONSTANT1.val)
if constant_directive.TYPE1_CONSTANT2.val != 2:
raise RuntimeError("constant_directive.TYPE1_CONSTANT2.val is %r (should be 2)" % constant_directive.TYPE1_CONSTANT2.val)
if constant_directive.TYPE1_CONSTANT3.val != 3:
raise RuntimeError("constant_directive.TYPE1_CONSTANT3.val is %r (should be 3)" % constant_directive.TYPE1_CONSTANT3.val)

View file

@ -1,7 +1,16 @@
#!/usr/bin/evn python
from cpp_static import *
StaticFunctionTest.static_func()
StaticFunctionTest.static_func_2(1)
StaticFunctionTest.static_func_3(1,2)
def is_new_style_class(cls):
return hasattr(cls, "__class__")
if is_new_style_class(StaticFunctionTest):
StaticFunctionTest.static_func()
StaticFunctionTest.static_func_2(1)
StaticFunctionTest.static_func_3(1,2)
else:
StaticFunctionTest().static_func()
StaticFunctionTest().static_func_2(1)
StaticFunctionTest().static_func_3(1,2)
StaticMemberTest.static_int = 10
assert StaticMemberTest.static_int == 10

View file

@ -1,67 +1,98 @@
import default_args
# Note that this test is also used by python_default_args_runme.py hence the use of __main__ and the run function
ec = default_args.EnumClass()
if not ec.blah():
raise RuntimeError,"EnumClass::blah() default arguments don't work"
def is_new_style_class(cls):
return hasattr(cls, "__class__")
if default_args.Statics_staticMethod() != 60:
raise RuntimeError
if default_args.cfunc1(1) != 2:
raise RuntimeError
def run(module_name):
default_args = __import__(module_name)
ec = default_args.EnumClass()
if not ec.blah():
raise RuntimeError("EnumClass::blah() default arguments don't work")
if default_args.cfunc2(1) != 3:
raise RuntimeError
de = default_args.DerivedEnumClass()
de.accelerate()
de.accelerate(default_args.EnumClass.SLOW)
if default_args.cfunc3(1) != 4:
raise RuntimeError
if default_args.Statics_staticMethod() != 60:
raise RuntimeError
if default_args.cfunc1(1) != 2:
raise RuntimeError
if default_args.cfunc2(1) != 3:
raise RuntimeError
if default_args.cfunc3(1) != 4:
raise RuntimeError
f = default_args.Foo()
f = default_args.Foo()
f.newname()
f.newname(1)
f.newname()
f.newname(1)
try:
f = default_args.Foo(1)
error = 1
except:
error = 0
if error: raise RuntimeError,"Foo::Foo ignore is not working"
try:
f = default_args.Foo(1)
error = 1
except:
error = 0
if error: raise RuntimeError("Foo::Foo ignore is not working")
try:
f = default_args.Foo(1,2)
error = 1
except:
error = 0
if error: raise RuntimeError,"Foo::Foo ignore is not working"
try:
f = default_args.Foo(1,2)
error = 1
except:
error = 0
if error: raise RuntimeError("Foo::Foo ignore is not working")
try:
f = default_args.Foo(1,2,3)
error = 1
except:
error = 0
if error: raise RuntimeError,"Foo::Foo ignore is not working"
try:
f = default_args.Foo(1,2,3)
error = 1
except:
error = 0
if error: raise RuntimeError("Foo::Foo ignore is not working")
try:
m = f.meth(1)
error = 1
except:
error = 0
if error: raise RuntimeError,"Foo::meth ignore is not working"
try:
m = f.meth(1)
error = 1
except:
error = 0
if error: raise RuntimeError("Foo::meth ignore is not working")
try:
m = f.meth(1,2)
error = 1
except:
error = 0
if error: raise RuntimeError,"Foo::meth ignore is not working"
try:
m = f.meth(1,2)
error = 1
except:
error = 0
if error: raise RuntimeError("Foo::meth ignore is not working")
try:
m = f.meth(1,2,3)
error = 1
except:
error = 0
if error: raise RuntimeError,"Foo::meth ignore is not working"
try:
m = f.meth(1,2,3)
error = 1
except:
error = 0
if error: raise RuntimeError("Foo::meth ignore is not working")
if is_new_style_class(default_args.Klass):
Klass_inc = default_args.Klass.inc
else:
Klass_inc = default_args.Klass_inc
if Klass_inc(100, default_args.Klass(22)).val != 122:
raise RuntimeError("Klass::inc failed")
if Klass_inc(100).val != 99:
raise RuntimeError("Klass::inc failed")
if Klass_inc().val != 0:
raise RuntimeError("Klass::inc failed")
default_args.trickyvalue1(10); default_args.trickyvalue1(10, 10)
default_args.trickyvalue2(10); default_args.trickyvalue2(10, 10)
default_args.trickyvalue3(10); default_args.trickyvalue3(10, 10)
default_args.seek(); default_args.seek(10)
if __name__=="__main__":
run('default_args')

View file

@ -1,5 +1,8 @@
import director_abstract
def is_new_style_class(cls):
return hasattr(cls, "__class__")
class MyFoo(director_abstract.Foo):
def __init__(self):
director_abstract.Foo.__init__(self)
@ -32,12 +35,20 @@ me1 = MyExample1()
if director_abstract.Example1_get_color(me1, 1,2,3) != 1:
raise RuntimeError
if is_new_style_class(MyExample2):
MyExample2_static = MyExample2
else:
MyExample2_static = MyExample2(0, 0)
me2 = MyExample2(1,2)
if MyExample2.get_color(me2, 1,2,3) != 2:
if MyExample2_static.get_color(me2, 1,2,3) != 2:
raise RuntimeError
if is_new_style_class(MyExample3):
MyExample3_static = MyExample3
else:
MyExample3_static = MyExample3()
me3 = MyExample3()
if MyExample3.get_color(me3, 1,2,3) != 3:
if MyExample3_static.get_color(me3, 1,2,3) != 3:
raise RuntimeError
error = 1

View file

@ -1,5 +1,8 @@
from global_namespace import *
def is_new_style_class(cls):
return hasattr(cls, "__class__")
k1 = Klass1()
k2 = Klass2()
k3 = Klass3()
@ -8,8 +11,12 @@ k5 = Klass5()
k6 = Klass6()
k7 = Klass7()
KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7)
KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7)
if is_new_style_class(KlassMethods):
KlassMethods_static = KlassMethods
else:
KlassMethods_static = KlassMethods()
KlassMethods_static.methodA(k1, k2, k3, k4, k5, k6, k7)
KlassMethods_static.methodB(k1, k2, k3, k4, k5, k6, k7)
k1 = getKlass1A()
k2 = getKlass2A()
@ -19,8 +26,8 @@ k5 = getKlass5A()
k6 = getKlass6A()
k7 = getKlass7A()
KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7)
KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7)
KlassMethods_static.methodA(k1, k2, k3, k4, k5, k6, k7)
KlassMethods_static.methodB(k1, k2, k3, k4, k5, k6, k7)
k1 = getKlass1B()
k2 = getKlass2B()
@ -30,11 +37,19 @@ k5 = getKlass5B()
k6 = getKlass6B()
k7 = getKlass7B()
KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7)
KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7)
KlassMethods_static.methodA(k1, k2, k3, k4, k5, k6, k7)
KlassMethods_static.methodB(k1, k2, k3, k4, k5, k6, k7)
XYZMethods.methodA(XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
XYZMethods.methodB(XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
if is_new_style_class(XYZMethods):
XYZMethods_static = XYZMethods
else:
XYZMethods_static = XYZMethods()
XYZMethods_static.methodA(XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
XYZMethods_static.methodB(XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
TheEnumMethods.methodA(theenum1, theenum2, theenum3)
TheEnumMethods.methodA(theenum1, theenum2, theenum3)
if is_new_style_class(TheEnumMethods):
TheEnumMethods_static = TheEnumMethods
else:
TheEnumMethods_static = TheEnumMethods()
TheEnumMethods_static.methodA(theenum1, theenum2, theenum3)
TheEnumMethods_static.methodA(theenum1, theenum2, theenum3)

View file

@ -4,6 +4,9 @@ def check(a, b):
if a != b:
raise RuntimeError(str(a) + " does not equal " + str(b))
def is_new_style_class(cls):
return hasattr(cls, "__class__")
#### Class ####
# No implicit conversion
@ -39,13 +42,17 @@ check(2, A_int(1.0).get())
check(3, A_int(B()).get())
check(4, A_int("hello").get())
check(1, A_int.sget(1))
check(2, A_int.sget(1.0))
check(3, A_int.sget(B()))
if is_new_style_class(A_int):
A_int_static = A_int
else:
A_int_static = A_int(0)
check(1, A_int_static.sget(1))
check(2, A_int_static.sget(1.0))
check(3, A_int_static.sget(B()))
# explicit constructor:
try:
check(4, A_int.sget("hello"))
check(4, A_int_static.sget("hello"))
raise RuntimeError
except TypeError:
pass

View file

@ -51,7 +51,7 @@ if foo_fn(b=2) != 3:
raise RuntimeError
#Funtions with keywords
#Functions with keywords
if foo_kw(_from=2) != 4:
raise RuntimeError
@ -65,3 +65,17 @@ if foo_mm(min=2) != 4:
if foo_mm(max=3) != 4:
raise RuntimeError
#Default args with references
if rfoo(n=123) != 120:
raise RuntimeError
if rfoo(x=10) != -10:
raise RuntimeError
if rfoo(n=11, x=22) != -11:
raise RuntimeError
if rfoo(x=11, n=22) != 11:
raise RuntimeError

View file

@ -1,5 +1,8 @@
from li_boost_shared_ptr_bits import *
def is_new_style_class(cls):
return hasattr(cls, "__class__")
def check(nd):
nd.i = 200
i = nd.i
@ -30,5 +33,8 @@ if sum != 66:
raise "sum is wrong"
################################
p = HiddenDestructor.create()
if is_new_style_class(HiddenDestructor):
p = HiddenDestructor.create()
else:
p = HiddenDestructor_create()

View file

@ -17,7 +17,7 @@ class li_boost_shared_ptr_runme:
self.runtest()
# Expect 1 instance - the one global variable (GlobalValue)
if (li_boost_shared_ptr.Klass.getTotal_count() != 1):
if (li_boost_shared_ptr.Klass_getTotal_count() != 1):
raise RuntimeError("Klass.total_count=%s" % li_boost_shared_ptr.Klass.getTotal_count())
wrapper_count = li_boost_shared_ptr.shared_ptr_wrapper_count()

View file

@ -2,16 +2,16 @@ from li_std_auto_ptr import *
k1 = makeKlassAutoPtr("first")
k2 = makeKlassAutoPtr("second")
if Klass.getTotal_count() != 2:
if Klass_getTotal_count() != 2:
raise "number of objects should be 2"
del k1
if Klass.getTotal_count() != 1:
if Klass_getTotal_count() != 1:
raise "number of objects should be 1"
if k2.getLabel() != "second":
raise "wrong object label"
del k2
if Klass.getTotal_count() != 0:
if Klass_getTotal_count() != 0:
raise "no objects should be left"

View file

@ -1,5 +1,8 @@
from namespace_class import *
def is_new_style_class(cls):
return hasattr(cls, "__class__")
try:
p = Private1()
error = 1
@ -18,7 +21,10 @@ except:
if (error):
raise RuntimeError, "Private2 is private"
EulerT3D.toFrame(1,1,1)
if is_new_style_class(EulerT3D):
EulerT3D.toFrame(1,1,1)
else:
EulerT3D().toFrame(1,1,1)
b = BooT_i()
b = BooT_H()
@ -33,6 +39,7 @@ f.moo(1)
f = FooT_H()
f.foo(Hi)
f_type = str(type(f))
if f_type.find("'namespace_class.FooT_H'") == -1:
raise RuntimeError("Incorrect type: " + f_type)
if is_new_style_class(FooT_H):
f_type = str(type(f))
if f_type.find("'namespace_class.FooT_H'") == -1:
raise RuntimeError("Incorrect type: " + f_type)

View file

@ -0,0 +1,13 @@
from nested_template_base import *
ois = InnerS(123);
oic = InnerC();
# Check base method is available
if (oic.outer(ois).val != 123):
raise RuntimeError("Wrong value calling outer");
# Check non-derived class using base class
if (oic.innerc().outer(ois).val != 123):
raise RuntimeError("Wrong value calling innerc");

View file

@ -1,4 +1,8 @@
from overload_template_fast import *
def is_new_style_class(cls):
return hasattr(cls, "__class__")
f = foo()
a = maximum(3,4)
@ -140,6 +144,9 @@ if (nsoverload() != 1050):
raise RuntimeError, ("nsoverload(const char *)")
A.foo(1)
if is_new_style_class(A):
A.foo(1)
else:
A_foo(1)
b = B()
b.foo(1)

View file

@ -12,3 +12,5 @@ if preproc.defined != 1:
if 2*preproc.one != preproc.two:
raise RuntimeError
if preproc.methodX(99) != 199:
raise RuntimeError

View file

@ -1,12 +1,18 @@
from python_append import *
def is_new_style_class(cls):
return hasattr(cls, "__class__")
# test not relevant for -builtin
if is_python_builtin():
exit(0)
t=Test()
t.func()
t.static_func()
if is_new_style_class(Test):
t.static_func()
else:
Test_static_func()
if grabpath() != os.path.dirname(mypath):
raise RuntimeError("grabpath failed")

View file

@ -5,7 +5,7 @@ from refcount import *
a = A3()
b1 = B(a)
b2 = B.create(a)
b2 = B_create(a)
@ -14,7 +14,7 @@ if a.ref_count() != 3:
rca = b2.get_rca()
b3 = B.create(rca)
b3 = B_create(rca)
if a.ref_count() != 5:
raise RuntimeError("Count = %d" % a.ref_count())
@ -39,7 +39,7 @@ b5 = global_create(a)
if b5.ref_count() != 1:
raise RuntimeError
b6 = Factory.create(a)
b6 = Factory_create(a)
if b6.ref_count() != 1:
raise RuntimeError

View file

@ -1,12 +1,12 @@
import return_const_value
import sys
p = return_const_value.Foo_ptr.getPtr()
p = return_const_value.Foo_ptr_getPtr()
if (p.getVal() != 17):
print "Runtime test1 faild. p.getVal()=", p.getVal()
sys.exit(1)
p = return_const_value.Foo_ptr.getConstPtr()
p = return_const_value.Foo_ptr_getConstPtr()
if (p.getVal() != 17):
print "Runtime test2 faild. p.getVal()=", p.getVal()
sys.exit(1)

View file

@ -56,7 +56,7 @@ def test(b, f):
raise RuntimeError
# Test static method
b.stat()
b.statMethod()
if f.access != CONST_ACCESS:
raise RuntimeError

View file

@ -1,5 +1,8 @@
from smart_pointer_member import *
def is_new_style_class(cls):
return hasattr(cls, "__class__")
f = Foo()
f.y = 1
@ -20,8 +23,9 @@ if b.x != f.x:
if b.z != f.z:
raise RuntimeError
if Foo.z == Bar.z:
raise RuntimeError
if is_new_style_class(Bar): # feature not supported in old style classes
if Foo.z == Bar.z:
raise RuntimeError

View file

@ -1,5 +1,5 @@
from typemap_out_optimal import *
cvar.XX_debug = False
x = XX.create()
x = XX_create()