summaryrefslogtreecommitdiff
path: root/Examples/test-suite/python/primitive_types_runme.py
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/python/primitive_types_runme.py')
-rw-r--r--Examples/test-suite/python/primitive_types_runme.py78
1 files changed, 39 insertions, 39 deletions
diff --git a/Examples/test-suite/python/primitive_types_runme.py b/Examples/test-suite/python/primitive_types_runme.py
index 729b450a6..f550fc2ab 100644
--- a/Examples/test-suite/python/primitive_types_runme.py
+++ b/Examples/test-suite/python/primitive_types_runme.py
@@ -172,7 +172,7 @@ p = PyTest()
# internal call check
if t.c_check() != p.c_check():
- raise RuntimeError, "bad director"
+ raise RuntimeError("bad director")
p.var_bool = p.stc_bool
p.var_schar = p.stc_schar
@@ -247,11 +247,11 @@ if t.var_namet != "hol":
cvar.var_char = "\0"
if cvar.var_char != "\0":
- raise RuntimeError, "bad char '0' case"
+ raise RuntimeError("bad char '0' case")
cvar.var_char = 0
if cvar.var_char != "\0":
- raise RuntimeError, "bad char '0' case"
+ raise RuntimeError("bad char '0' case")
cvar.var_namet = "\0"
# if cvar.var_namet != "\0\0\0\0\0":
@@ -261,11 +261,11 @@ if cvar.var_namet != "":
cvar.var_namet = ""
# if cvar.var_namet != "\0\0\0\0\0":
if cvar.var_namet != "":
- raise RuntimeError, "bad char empty case"
+ raise RuntimeError("bad char empty case")
cvar.var_pchar = None
if cvar.var_pchar != None:
- raise RuntimeError, "bad None case"
+ raise RuntimeError("bad None case")
cvar.var_pchar = ""
if cvar.var_pchar != "":
@@ -273,11 +273,11 @@ if cvar.var_pchar != "":
cvar.var_pcharc = None
if cvar.var_pcharc != None:
- raise RuntimeError, "bad None case"
+ raise RuntimeError("bad None case")
cvar.var_pcharc = ""
if cvar.var_pcharc != "":
- raise RuntimeError, "bad char empty case"
+ raise RuntimeError("bad char empty case")
#
@@ -298,7 +298,7 @@ if cvar.var_pchar != "hola":
cvar.var_namet = pc
# if cvar.var_namet != "hola\0":
if cvar.var_namet != "hola":
- raise RuntimeError, "bad pointer case"
+ raise RuntimeError("bad pointer case")
delete_pchar(pc)
@@ -317,7 +317,7 @@ except OverflowError:
error = 1
pass
if error:
- raise RuntimeError, "bad uchar typemap"
+ raise RuntimeError("bad uchar typemap")
try:
@@ -330,7 +330,7 @@ except TypeError:
error = 1
pass
if error:
- raise RuntimeError, "bad char typemap"
+ raise RuntimeError("bad char typemap")
try:
error = 0
@@ -342,7 +342,7 @@ except OverflowError:
error = 1
pass
if error:
- raise RuntimeError, "bad ushort typemap"
+ raise RuntimeError("bad ushort typemap")
try:
error = 0
@@ -354,7 +354,7 @@ except OverflowError:
error = 1
pass
if error:
- raise RuntimeError, "bad uint typemap"
+ raise RuntimeError("bad uint typemap")
try:
error = 0
@@ -366,7 +366,7 @@ except OverflowError:
error = 1
pass
if error:
- raise RuntimeError, "bad sizet typemap"
+ raise RuntimeError("bad sizet typemap")
try:
error = 0
@@ -378,7 +378,7 @@ except OverflowError:
error = 1
pass
if error:
- raise RuntimeError, "bad ulong typemap"
+ raise RuntimeError("bad ulong typemap")
#
#
@@ -392,43 +392,43 @@ except TypeError:
error = 1
pass
if error:
- raise RuntimeError, "bad namet typemap"
+ raise RuntimeError("bad namet typemap")
#
#
#
t2 = p.vtest(t)
if t.var_namet != t2.var_namet:
- raise RuntimeError, "bad SWIGTYPE* typemap"
+ raise RuntimeError("bad SWIGTYPE* typemap")
if cvar.fixsize != "ho\0la\0\0\0":
- raise RuntimeError, "bad FIXSIZE typemap"
+ raise RuntimeError("bad FIXSIZE typemap")
cvar.fixsize = "ho"
if cvar.fixsize != "ho\0\0\0\0\0\0":
- raise RuntimeError, "bad FIXSIZE typemap"
+ raise RuntimeError("bad FIXSIZE typemap")
f = Foo(3)
f1 = fptr_val(f)
f2 = fptr_ref(f)
if f1._a != f2._a:
- raise RuntimeError, "bad const ptr& typemap"
+ raise RuntimeError("bad const ptr& typemap")
v = char_foo(1, 3)
if v != 3:
- raise RuntimeError, "bad int typemap"
+ raise RuntimeError("bad int typemap")
s = char_foo(1, "hello")
if s != "hello":
- raise RuntimeError, "bad char* typemap"
+ raise RuntimeError("bad char* typemap")
v = SetPos(1, 3)
if v != 4:
- raise RuntimeError, "bad int typemap"
+ raise RuntimeError("bad int typemap")
#
# Check the bounds for converting various types
@@ -472,8 +472,8 @@ maxllong = overllong - 1
maxullong = 2 * maxllong + 1
# Make sure Python 2's sys.maxint is the same as the maxlong we calculated
-if sys.version_info[0] <= 2 and maxlong != sys.maxint:
- raise RuntimeError, "sys.maxint is not the maximum value of a signed long"
+if sys.version_info[0] <= 2 and maxlong != sys.maxsize:
+ raise RuntimeError("sys.maxint is not the maximum value of a signed long")
def checkType(t, e, val, delta):
"""t = Test object, e = type name (e.g. ulong), val = max or min allowed value, delta = +1 for max, -1 for min"""
@@ -503,7 +503,7 @@ def checkType(t, e, val, delta):
except OverflowError:
pass
if error:
- raise RuntimeError, "bad " + e + " typemap"
+ raise RuntimeError("bad " + e + " typemap")
def checkFull(t, e, maxval, minval):
"""Check the maximum and minimum bounds for the type given by e"""
@@ -535,17 +535,17 @@ def checkOverload(t, name, val, delta, prevval, limit):
if val != prevval:
# Make sure the most extreme value of this type gives the name of this type
if t.ovr_str(val) != name:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
# Make sure a more extreme value doesn't give the name of this type
try:
if t.ovr_str(val + delta) == name:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
if val == limit:
# Should raise TypeError here since this is the largest integral type
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
except TypeError:
if val != limit:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
# Check that overloading works: uchar > schar > ushort > short > uint > int > ulong > long > ullong > llong
checkOverload(t, "uchar", maxuchar, +1, 0, maxullong)
@@ -560,22 +560,22 @@ checkOverload(t, "long", minlong, -1, minint, minllong)
checkOverload(t, "llong", minllong, -1, minlong, minllong)
# Make sure that large ints can be converted to doubles properly
-if val_double(sys.maxint + 1) != float(sys.maxint + 1):
- raise RuntimeError, "bad double typemap"
-if val_double(-sys.maxint - 2) != float(-sys.maxint - 2):
- raise RuntimeError, "bad double typemap"
+if val_double(sys.maxsize + 1) != float(sys.maxsize + 1):
+ raise RuntimeError("bad double typemap")
+if val_double(-sys.maxsize - 2) != float(-sys.maxsize - 2):
+ raise RuntimeError("bad double typemap")
# Check the minimum and maximum values that fit in ptrdiff_t and size_t
def checkType(name, maxfunc, maxval, minfunc, minval, echofunc):
if maxfunc() != maxval:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
if minfunc() != minval:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
if echofunc(maxval) != maxval:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
if echofunc(minval) != minval:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
error = 0
try:
echofunc(maxval + 1)
@@ -583,14 +583,14 @@ def checkType(name, maxfunc, maxval, minfunc, minval, echofunc):
except OverflowError:
pass
if error == 1:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
try:
echofunc(minval - 1)
error = 1
except OverflowError:
pass
if error == 1:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
# sys.maxsize is the largest value supported by Py_ssize_t, which should be the same as ptrdiff_t
if sys.version_info[0:2] >= (2, 6):