Convert swigobject python test to be python 2 and 3 compatible
This commit is contained in:
parent
982b08dced
commit
36bb54f01d
1 changed files with 13 additions and 4 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
from swigobject import *
|
from swigobject import *
|
||||||
|
import sys
|
||||||
|
|
||||||
a = A()
|
a = A()
|
||||||
|
|
||||||
|
|
@ -11,7 +11,11 @@ if a1.this != a2.this:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
||||||
lthis = long(a.this)
|
if sys.version_info[0:2] < (3, 0):
|
||||||
|
lthis = long(a.this)
|
||||||
|
else:
|
||||||
|
lthis = int(a.this)
|
||||||
|
|
||||||
# match pointer value, but deal with leading zeros on 8/16 bit systems and
|
# match pointer value, but deal with leading zeros on 8/16 bit systems and
|
||||||
# different C++ compilers interpretation of %p
|
# different C++ compilers interpretation of %p
|
||||||
xstr1 = "%016X" % (lthis,)
|
xstr1 = "%016X" % (lthis,)
|
||||||
|
|
@ -30,5 +34,10 @@ r = repr(a.this)
|
||||||
|
|
||||||
v1 = v_ptr(a)
|
v1 = v_ptr(a)
|
||||||
v2 = v_ptr(a)
|
v2 = v_ptr(a)
|
||||||
if long(v1) != long(v2):
|
|
||||||
raise RuntimeError
|
if sys.version_info[0:2] < (3, 0):
|
||||||
|
if long(v1) != long(v2):
|
||||||
|
raise RuntimeError
|
||||||
|
else:
|
||||||
|
if int(v1) != int(v2):
|
||||||
|
raise RuntimeError
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue