Commit 7497e401 authored by gsamain's avatar gsamain

Basic test for multiple inheritance

parent 89b7f63b
cdef cypclass A:
int a
void __init__(self, int arg=0):
self.a = arg
A __iadd__(self, A other):
self.a += other.a
int getter(self):
return self.a
cdef cypclass B:
int b
void __init__(self, int arg=0):
self.b = arg
B __isub__(self, B other):
self.b -= other.b
int getter(self):
return self.b
cdef cypclass C(A,B):
void __init__(self, int arg=0):
self.a = self.b = arg
cpdef bag():
a = A(3)
b = B(4)
c = C(5)
c += a
c -= b
return str(a.a) + '\n' + str(b.b) + '\n' + str(c.a) + '\n' + str(c.b)\
+ '\n' + str(A.getter(c)) + '\n' + str(B.getter(c))
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
setup(
ext_modules = cythonize([
Extension(
'cypclass_test_multiple_inheritance',
language='c++',
sources=['cypclass_test_multiple_inheritance.pyx'],
extra_compile_args=["-pthread", "-std=c++11"],
),
])
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment