four new director tests
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4449 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
5a7faa47a1
commit
99cef9c7da
9 changed files with 299 additions and 0 deletions
43
SWIG/Examples/test-suite/python/director_exception_runme.py
Normal file
43
SWIG/Examples/test-suite/python/director_exception_runme.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
from director_exception import *
|
||||
from exceptions import *
|
||||
|
||||
class MyFoo(Foo):
|
||||
def ping(self):
|
||||
raise NotImplementedError, "MyFoo::ping() EXCEPTION"
|
||||
|
||||
class MyFoo2(Foo):
|
||||
def ping(self):
|
||||
pass # error: should return a string
|
||||
|
||||
ok = 0
|
||||
|
||||
a = MyFoo()
|
||||
b = launder(a)
|
||||
|
||||
try:
|
||||
b.pong()
|
||||
except NotImplementedError, e:
|
||||
ok = 1
|
||||
except:
|
||||
pass
|
||||
|
||||
if not ok:
|
||||
raise RuntimeError
|
||||
|
||||
ok = 0
|
||||
|
||||
a = MyFoo2()
|
||||
b = launder(a)
|
||||
|
||||
try:
|
||||
b.pong()
|
||||
except TypeError, e:
|
||||
ok = 1
|
||||
except:
|
||||
pass
|
||||
|
||||
if not ok:
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue