This commit contains all changes to the regression tests which

are necessitated by the -builtin option.  Notes on individual tests
follow.

grouping_runme.py : 'cvar' syntax for class variables is obsolete.

li_std_string_extra_runme.py :
li_std_wstring_runme.py : Reverse binary operators (e.g., __radd__)
are not supported.

threads_exception_runme.py :
director_exception_runme.py :
exception_order_runme.py : Throwing wrapped objects as exceptions
is not supported.

default_constructor_runme.py : Redundant functional interface
(e.g., 'module.new_Foo()' for 'module.Foo()') is not provided.

python_nondynamic_runme.py : I believe that this test script doesn't
actually test the %pythonnondynamic feature correctly, and I believe
that the feature itself is implemented incorrectly.  With the -builtin
option, %pythonnondynamic *is* implemented correctly, and I have
modified the test script to exercise it correctly.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12416 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Stefan Zager 2011-01-30 04:13:58 +00:00
parent 288c37f5bf
commit 002598680e
8 changed files with 134 additions and 57 deletions

View File

@ -2,78 +2,123 @@ import _default_constructor
dc = _default_constructor
a = dc.new_A()
dc.delete_A(a)
# Old static syntax not supported
#a = dc.new_A()
#dc.delete_A(a)
a = dc.A()
del a
aa = dc.new_AA()
dc.delete_AA(aa)
# Old static syntax not supported
#aa = dc.new_AA()
#dc.delete_AA(aa)
aa = dc.AA()
del aa
try:
b = dc.new_B()
# Old static syntax not supported
#b = dc.new_B()
b = dc.B()
print "Whoa. new_BB created."
except:
pass
del_b = dc.delete_B
# Old static syntax not supported.
# Swig builtin types have no tp_del entry (only tp_dealloc).
#del_b = dc.delete_B
try:
bb = dc.new_BB();
# Old static syntax not supported.
#bb = dc.new_BB();
bb = dc.BB()
print "Whoa. new_BB created."
except:
pass
del_bb = dc.delete_BB
# Old static syntax not supported.
# Swig builtin types have no tp_del entry (only tp_dealloc).
#del_bb = dc.delete_BB
try:
c = dc.new_C()
# Old static syntax not supported
#c = dc.new_C()
c = dc.C()
print "Whoa. new_C created."
except:
pass
del_c = dc.delete_C
# Old static syntax not supported.
# Swig builtin types have no tp_del entry (only tp_dealloc).
#del_c = dc.delete_C
cc = dc.new_CC()
dc.delete_CC(cc)
# Old static syntax not supported.
#cc = dc.new_CC()
#dc.delete_CC(cc)
cc = dc.CC()
del cc
try:
d = dc.new_D();
# Old static syntax not supported.
#d = dc.new_D();
d = dc.D()
print "Whoa. new_D created"
except:
pass
del_d = dc.delete_D
# Old static syntax not supported.
# Swig builtin types have no tp_del entry (only tp_dealloc).
#del_d = dc.delete_D
try:
dd = dc.new_DD()
# Old static syntax not supported.
#dd = dc.new_DD()
dd = dc.DD()
print "Whoa. new_DD created"
except:
pass
dd = dc.delete_DD
# Old static syntax not supported.
# Swig builtin types have no tp_del entry (only tp_dealloc).
#dd = dc.delete_DD
try:
ad = dc.new_AD()
# Old static syntax not supported.
#ad = dc.new_AD()
ad = dc.AD()
print "Whoa. new_AD created"
except:
pass
del_ad = dc.delete_AD
# Old static syntax not supported.
# Swig builtin types have no tp_del entry (only tp_dealloc).
#del_ad = dc.delete_AD
e = dc.new_E()
dc.delete_E(e)
# Old static syntax not supported.
#e = dc.new_E()
#dc.delete_E(e)
e = dc.E()
del e
ee = dc.new_EE()
dc.delete_EE(ee)
# Old static syntax not supported.
#ee = dc.new_EE()
#dc.delete_EE(ee)
ee = dc.EE()
del ee
try:
eb = dc.new_EB()
# Old static syntax not supported.
#eb = dc.new_EB()
eb = dc.EB()
print "Whoa. new_EB created"
except:
pass
del_eb = dc.delete_EB
# Old static syntax not supported.
# Swig builtin types have no tp_del entry (only tp_dealloc).
#del_eb = dc.delete_EB
f = dc.new_F()
# Old static syntax not supported.
#f = dc.new_F()
f = dc.F()
try:
del_f = dc.delete_F
@ -81,18 +126,27 @@ try:
except AttributeError:
pass
dc.F_destroy(f)
# Old static syntax not supported.
#dc.F_destroy(f)
f.destroy()
# Old static syntax not supported.
#ff = dc.new_FFF()
ff = dc.FFF()
ff = dc.new_FFF()
try:
del_ff = dc.delete_FFF
print "Whoa. delete_FFF created"
except AttributeError:
pass
dc.F_destroy(ff)
# Old static syntax not supported.
#dc.F_destroy(ff)
ff.destroy()
g = dc.new_G()
# Old static syntax not supported.
#g = dc.new_G()
g = dc.G()
try:
del_g = dc.delete_G
@ -100,11 +154,13 @@ try:
except AttributeError:
pass
dc.G_destroy(g)
gg = dc.new_GG()
dc.delete_GG(gg)
dc.G.destroy(g)
# Old static syntax not supported.
#gg = dc.new_GG()
#dc.delete_GG(gg)
gg = dc.GG()
del gg
import default_constructor
hh = default_constructor.HH(1,1)

View File

@ -66,12 +66,14 @@ except MyException, e:
if not ok:
raise RuntimeError
try:
raise Exception2()
except Exception2:
pass
# Throwing builtin classes as exceptions not supported
#try:
# raise Exception2()
#except Exception2:
# pass
try:
raise Exception1()
except Exception1:
pass
# Throwing builtin classes as exceptions not supported
#try:
# raise Exception1()
#except Exception1:
# pass

View File

@ -8,14 +8,18 @@ try:
except E1,e:
pass
except:
raise RuntimeError, "bad exception order"
# Throwing builtin classes as exceptions not supported
#raise RuntimeError, "bad exception order"
pass
try:
a.bar()
except E2,e:
pass
except:
raise RuntimeError, "bad exception order"
# Throwing builtin classes as exceptions not supported
#raise RuntimeError, "bad exception order"
pass
try:
a.foobar()
@ -31,11 +35,15 @@ try:
except E1,e:
pass
except:
raise RuntimeError, "bad exception order"
# Throwing builtin classes as exceptions not supported
#raise RuntimeError, "bad exception order"
pass
try:
a.barfoo(2)
except E2,e:
pass
except:
raise RuntimeError, "bad exception order"
# Throwing builtin classes as exceptions not supported
#raise RuntimeError, "bad exception order"
pass

View File

@ -11,3 +11,4 @@ if x != -37:
raise RuntimeError
grouping.cvar.test3 = 42
grouping.test3 = 42

View File

@ -54,12 +54,14 @@ if a + b != "hello world":
if a + " world" != "hello world":
raise RuntimeError, "bad string mapping"
if "hello" + b != "hello world":
raise RuntimeError, "bad string mapping"
# Reverse operators not supported in builtin types
#if "hello" + b != "hello world":
# raise RuntimeError, "bad string mapping"
c = "hello" + b
if c.find_last_of("l") != 9:
raise RuntimeError, "bad string mapping"
# Reverse operators not supported in builtin types
#c = "hello" + b
#if c.find_last_of("l") != 9:
# raise RuntimeError, "bad string mapping"
s = "hello world"

View File

@ -53,12 +53,14 @@ if a + b != "hello world":
if a + " world" != "hello world":
raise RuntimeError, "bad string mapping"
if "hello" + b != "hello world":
raise RuntimeError, "bad string mapping"
# With -builtin option, no reverse binary operators
#if "hello" + b != "hello world":
# raise RuntimeError, "bad string mapping"
c = "hello" + b
if c.find_last_of("l") != 9:
raise RuntimeError, "bad string mapping"
# With -builtin option, no reverse binary operators
#c = "hello" + b
#if c.find_last_of("l") != 9:
# raise RuntimeError, "bad string mapping"
s = "hello world"

View File

@ -24,7 +24,11 @@ class B(python_nondynamic.A):
bb = B()
bb.c = 3
# This is questionable. Trying to set B.c? That's not what it does.
# Should fail, I think, but it doesn't.
#bb.c = 3
try:
bb.d = 2
err = 0

View File

@ -19,7 +19,9 @@ except RuntimeError,e:
raise RuntimeError
try:
t.hosed()
# Throwing builtin classes as exceptions not supported
# t.hosed()
pass
except threads_exception.Exc,e:
if e.code != 42:
raise RuntimeError