summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2020-08-15 00:16:04 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2020-08-15 00:16:04 +0100
commitd4ffa46f4168b85524ec26c07426fe97dfcb3a38 (patch)
tree0aa17ee06f98efc31873726a254ce04d1ea31765
parent66df0bd2242b04125bc008142de749b962991675 (diff)
downloadswig-d4ffa46f4168b85524ec26c07426fe97dfcb3a38.tar.gz
Convert python tests using 2to3
These tests were converted using 2to3 and should be valid using Python 2.7 and Python 3+.
-rw-r--r--Examples/test-suite/python/array_member_runme.py4
-rw-r--r--Examples/test-suite/python/char_binary_runme.py10
-rw-r--r--Examples/test-suite/python/complextest_runme.py10
-rw-r--r--Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py10
-rw-r--r--Examples/test-suite/python/cpp11_decltype_runme.py8
-rw-r--r--Examples/test-suite/python/cpp11_hash_tables_runme.py16
-rw-r--r--Examples/test-suite/python/cpp11_null_pointer_constant_runme.py8
-rw-r--r--Examples/test-suite/python/cpp11_raw_string_literals_runme.py10
-rw-r--r--Examples/test-suite/python/cpp11_result_of_runme.py8
-rw-r--r--Examples/test-suite/python/cpp11_rvalue_reference_runme.py8
-rw-r--r--Examples/test-suite/python/cpp11_std_array_runme.py14
-rw-r--r--Examples/test-suite/python/cpp11_uniform_initialization_runme.py8
-rw-r--r--Examples/test-suite/python/director_abstract_runme.py4
-rw-r--r--Examples/test-suite/python/director_alternating_runme.py2
-rw-r--r--Examples/test-suite/python/director_basic_runme.py8
-rw-r--r--Examples/test-suite/python/director_comparison_operators_runme.py2
-rw-r--r--Examples/test-suite/python/director_detect_runme.py2
-rw-r--r--Examples/test-suite/python/director_exception_runme.py8
-rw-r--r--Examples/test-suite/python/director_extend_runme.py4
-rw-r--r--Examples/test-suite/python/director_frob_runme.py2
-rw-r--r--Examples/test-suite/python/director_nested_runme.py4
-rw-r--r--Examples/test-suite/python/director_protected_runme.py30
-rw-r--r--Examples/test-suite/python/director_smartptr_runme.py2
-rw-r--r--Examples/test-suite/python/exception_order_runme.py18
-rw-r--r--Examples/test-suite/python/fvirtual_runme.py2
-rw-r--r--Examples/test-suite/python/global_functions_runme.py10
-rw-r--r--Examples/test-suite/python/global_vars_runme.py4
-rw-r--r--Examples/test-suite/python/import_stl_runme.py2
-rw-r--r--Examples/test-suite/python/li_attribute_runme.py2
-rw-r--r--Examples/test-suite/python/li_boost_shared_ptr_runme.py4
-rw-r--r--Examples/test-suite/python/li_implicit_runme.py6
-rw-r--r--Examples/test-suite/python/li_std_containers_int_runme.py40
-rw-r--r--Examples/test-suite/python/li_std_map_runme.py16
-rw-r--r--Examples/test-suite/python/li_std_set_runme.py20
-rw-r--r--Examples/test-suite/python/li_std_string_extra_runme.py58
-rw-r--r--Examples/test-suite/python/li_std_vector_enum_runme.py2
-rw-r--r--Examples/test-suite/python/li_std_vector_extra_runme.py30
-rw-r--r--Examples/test-suite/python/minherit_runme.py40
-rw-r--r--Examples/test-suite/python/namespace_class_runme.py4
-rw-r--r--Examples/test-suite/python/overload_complicated_runme.py22
-rw-r--r--Examples/test-suite/python/overload_simple_runme.py50
-rw-r--r--Examples/test-suite/python/overload_subtype_runme.py4
-rw-r--r--Examples/test-suite/python/overload_template_fast_runme.py78
-rw-r--r--Examples/test-suite/python/overload_template_runme.py78
-rw-r--r--Examples/test-suite/python/pointer_reference_runme.py8
-rw-r--r--Examples/test-suite/python/primitive_types_runme.py78
-rw-r--r--Examples/test-suite/python/python_builtin_runme.py2
-rw-r--r--Examples/test-suite/python/python_overload_simple_cast_runme.py94
-rw-r--r--Examples/test-suite/python/python_richcompare_runme.py8
-rw-r--r--Examples/test-suite/python/std_containers_runme.py18
-rw-r--r--Examples/test-suite/python/struct_value_runme.py4
-rw-r--r--Examples/test-suite/python/template_classes_runme.py8
-rw-r--r--Examples/test-suite/python/template_default_arg_runme.py40
-rw-r--r--Examples/test-suite/python/template_typemaps_typedef2_runme.py14
-rw-r--r--Examples/test-suite/python/template_typemaps_typedef_runme.py14
-rw-r--r--Examples/test-suite/python/threads_exception_runme.py16
-rw-r--r--Examples/test-suite/python/typemap_arrays_runme.py2
-rw-r--r--Examples/test-suite/python/typename_runme.py8
-rw-r--r--Examples/test-suite/python/using_composition_runme.py18
-rw-r--r--Examples/test-suite/python/using_extend_runme.py12
-rw-r--r--Examples/test-suite/python/using_inherit_runme.py24
-rw-r--r--Examples/test-suite/python/using_private_runme.py6
-rw-r--r--Examples/test-suite/python/using_protected_runme.py2
-rw-r--r--Examples/test-suite/python/varargs_overload_runme.py36
-rw-r--r--Examples/test-suite/python/varargs_runme.py16
-rw-r--r--Examples/test-suite/python/virtual_derivation_runme.py2
66 files changed, 551 insertions, 551 deletions
diff --git a/Examples/test-suite/python/array_member_runme.py b/Examples/test-suite/python/array_member_runme.py
index de6e0f3e7..2708a6f37 100644
--- a/Examples/test-suite/python/array_member_runme.py
+++ b/Examples/test-suite/python/array_member_runme.py
@@ -5,7 +5,7 @@ f.data = cvar.global_data
for i in range(0, 8):
if get_value(f.data, i) != get_value(cvar.global_data, i):
- raise RuntimeError, "Bad array assignment"
+ raise RuntimeError("Bad array assignment")
for i in range(0, 8):
@@ -15,4 +15,4 @@ cvar.global_data = f.data
for i in range(0, 8):
if get_value(f.data, i) != get_value(cvar.global_data, i):
- raise RuntimeError, "Bad array assignment"
+ raise RuntimeError("Bad array assignment")
diff --git a/Examples/test-suite/python/char_binary_runme.py b/Examples/test-suite/python/char_binary_runme.py
index 83ae9f0ec..39c0b2447 100644
--- a/Examples/test-suite/python/char_binary_runme.py
+++ b/Examples/test-suite/python/char_binary_runme.py
@@ -7,9 +7,9 @@ if t.ustrlen("hile") != 4:
raise RuntimeError("bad multi-arg typemap {}".format(t.ustrlen("hile")))
if t.strlen("hil\0") != 4:
- raise RuntimeError, "bad multi-arg typemap"
+ raise RuntimeError("bad multi-arg typemap")
if t.ustrlen("hil\0") != 4:
- raise RuntimeError, "bad multi-arg typemap"
+ raise RuntimeError("bad multi-arg typemap")
#
# creating a raw char*
@@ -23,9 +23,9 @@ pchar_setitem(pc, 4, 0)
if t.strlen(pc) != 4:
- raise RuntimeError, "bad multi-arg typemap"
+ raise RuntimeError("bad multi-arg typemap")
if t.ustrlen(pc) != 4:
- raise RuntimeError, "bad multi-arg typemap"
+ raise RuntimeError("bad multi-arg typemap")
cvar.var_pchar = pc
if cvar.var_pchar != "hola":
@@ -34,6 +34,6 @@ 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)
diff --git a/Examples/test-suite/python/complextest_runme.py b/Examples/test-suite/python/complextest_runme.py
index 5cfc7ccab..4257cb3b0 100644
--- a/Examples/test-suite/python/complextest_runme.py
+++ b/Examples/test-suite/python/complextest_runme.py
@@ -3,16 +3,16 @@ import complextest
a = complex(-1, 2)
if complextest.Conj(a) != a.conjugate():
- raise RuntimeError, "bad complex mapping"
+ raise RuntimeError("bad complex mapping")
if complextest.Conjf(a) != a.conjugate():
- raise RuntimeError, "bad complex mapping"
+ raise RuntimeError("bad complex mapping")
if complextest.Conj2(a) != a.conjugate():
- raise RuntimeError, "bad complex mapping"
+ raise RuntimeError("bad complex mapping")
if complextest.Conjf2(a) != a.conjugate():
- raise RuntimeError, "bad complex mapping"
+ raise RuntimeError("bad complex mapping")
v = (complex(1, 2), complex(2, 3), complex(4, 3), 1)
@@ -27,4 +27,4 @@ p = complextest.ComplexPair()
p.z1 = complex(0, 1)
p.z2 = complex(0, -1)
if complextest.Conj(p.z2) != p.z1:
- raise RuntimeError, "bad complex mapping"
+ raise RuntimeError("bad complex mapping")
diff --git a/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py b/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py
index cc7b5cd91..e46a4772f 100644
--- a/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py
+++ b/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py
@@ -4,20 +4,20 @@ a = cpp11_alternate_function_syntax.SomeStruct()
res = a.addNormal(4, 5)
if res != 9:
- raise RuntimeError, ("SomeStruct::addNormal(4,5) returns ", res, " should be 9.")
+ raise RuntimeError("SomeStruct::addNormal(4,5) returns ", res, " should be 9.")
res = a.addAlternate(4, 5)
if res != 9:
- raise RuntimeError, ("SomeStruct::addAlternate(4,5) returns ", res, " should be 9.")
+ raise RuntimeError("SomeStruct::addAlternate(4,5) returns ", res, " should be 9.")
res = a.addAlternateConst(4, 5)
if res != 9:
- raise RuntimeError, ("SomeStruct::addAlternateConst(4,5) returns ", res, " should be 9.")
+ raise RuntimeError("SomeStruct::addAlternateConst(4,5) returns ", res, " should be 9.")
res = a.addAlternateNoExcept(4, 5)
if res != 9:
- raise RuntimeError, ("SomeStruct::addAlternateNoExcept(4,5) returns ", res, " should be 9.")
+ raise RuntimeError("SomeStruct::addAlternateNoExcept(4,5) returns ", res, " should be 9.")
res = a.addAlternateConstNoExcept(4, 5)
if res != 9:
- raise RuntimeError, ("SomeStruct::addAlternateConstNoExcept(4,5) returns ", res, " should be 9.")
+ raise RuntimeError("SomeStruct::addAlternateConstNoExcept(4,5) returns ", res, " should be 9.")
diff --git a/Examples/test-suite/python/cpp11_decltype_runme.py b/Examples/test-suite/python/cpp11_decltype_runme.py
index 1650d9004..a18f334dc 100644
--- a/Examples/test-suite/python/cpp11_decltype_runme.py
+++ b/Examples/test-suite/python/cpp11_decltype_runme.py
@@ -3,16 +3,16 @@ import cpp11_decltype
a = cpp11_decltype.A()
a.i = 5
if a.i != 5:
- raise RuntimeError, "Assignment to a.i failed."
+ raise RuntimeError("Assignment to a.i failed.")
a.j = 10
if a.j != 10:
- raise RuntimeError, "Assignment to a.j failed."
+ raise RuntimeError("Assignment to a.j failed.")
b = a.foo(5)
if b != 10:
- raise RuntimeError, "foo(5) should return 10."
+ raise RuntimeError("foo(5) should return 10.")
b = a.foo(6)
if b != 0:
- raise RuntimeError, "foo(6) should return 0."
+ raise RuntimeError("foo(6) should return 0.")
diff --git a/Examples/test-suite/python/cpp11_hash_tables_runme.py b/Examples/test-suite/python/cpp11_hash_tables_runme.py
index 7b772ff9a..3e7be49d0 100644
--- a/Examples/test-suite/python/cpp11_hash_tables_runme.py
+++ b/Examples/test-suite/python/cpp11_hash_tables_runme.py
@@ -10,14 +10,14 @@ for x in [cpp11_hash_tables.MapIntInt({1:7}),
cpp11_hash_tables.UnorderedMultiMapIntInt({1:7})
]:
- swig_assert_equal([(k, v) for k, v in x.iteritems()], [(1, 7)])
- swig_assert_equal(x.keys(), [1])
- swig_assert_equal(x.values(), [7])
- swig_assert_equal(x.items(), [(1, 7)])
+ swig_assert_equal([(k, v) for k, v in x.items()], [(1, 7)])
+ swig_assert_equal(list(x.keys()), [1])
+ swig_assert_equal(list(x.values()), [7])
+ swig_assert_equal(list(x.items()), [(1, 7)])
swig_assert_equal([k for k in x], [1])
- swig_assert_equal([i for i in x.iterkeys()], [1])
- swig_assert_equal([i for i in x.itervalues()], [7])
- swig_assert_equal([i for i in x.iteritems()], [(1, 7)])
+ swig_assert_equal([i for i in x.keys()], [1])
+ swig_assert_equal([i for i in x.values()], [7])
+ swig_assert_equal([i for i in x.items()], [(1, 7)])
swig_assert_equal(x[1], 7)
swig_assert_equal(2 in x, False)
@@ -33,7 +33,7 @@ for x in [cpp11_hash_tables.MapIntInt({1:7}),
for x in [cpp11_hash_tables.MultiMapIntInt({1:7}),
cpp11_hash_tables.UnorderedMultiMapIntInt({1:7})]:
x[1] = 9
- swig_assert_equal(sorted([v for k, v in x.iteritems()]), [7, 9])
+ swig_assert_equal(sorted([v for k, v in x.items()]), [7, 9])
swig_assert_equal(len(x), 2)
for x in [cpp11_hash_tables.SetInt([1]),
diff --git a/Examples/test-suite/python/cpp11_null_pointer_constant_runme.py b/Examples/test-suite/python/cpp11_null_pointer_constant_runme.py
index 54a8fe0eb..c39760344 100644
--- a/Examples/test-suite/python/cpp11_null_pointer_constant_runme.py
+++ b/Examples/test-suite/python/cpp11_null_pointer_constant_runme.py
@@ -3,15 +3,15 @@ import cpp11_null_pointer_constant
a = cpp11_null_pointer_constant.A()
if a._myA != None:
- raise RuntimeError, (
+ raise RuntimeError(
"cpp11_null_pointer_constant: _myA should be None, but is ", a._myA)
b = cpp11_null_pointer_constant.A()
if a._myA != b._myA:
- raise RuntimeError, (
+ raise RuntimeError(
"cpp11_null_pointer_constant: a._myA should be the same as b._myA, but ", a._myA, "!=", b._myA)
a._myA = cpp11_null_pointer_constant.A()
if a._myA == None:
- raise RuntimeError, (
- "cpp11_null_pointer_constant: _myA should be object, but is None")
+ raise RuntimeError((
+ "cpp11_null_pointer_constant: _myA should be object, but is None"))
diff --git a/Examples/test-suite/python/cpp11_raw_string_literals_runme.py b/Examples/test-suite/python/cpp11_raw_string_literals_runme.py
index 6a587b860..90e450f8b 100644
--- a/Examples/test-suite/python/cpp11_raw_string_literals_runme.py
+++ b/Examples/test-suite/python/cpp11_raw_string_literals_runme.py
@@ -34,19 +34,19 @@ if cvar.aa != "Wide string":
raise RuntimeError
if cvar.bb != "UTF-8 string":
- raise RuntimeError, cvar.wide
+ raise RuntimeError(cvar.wide)
if cvar.xx != ")I'm an \"ascii\" \\ string.":
- raise RuntimeError, cvar.xx
+ raise RuntimeError(cvar.xx)
if cvar.ee != ")I'm an \"ascii\" \\ string.":
- raise RuntimeError, cvar.ee
+ raise RuntimeError(cvar.ee)
if cvar.ff != "I'm a \"raw wide\" \\ string.":
- raise RuntimeError, cvar.ff
+ raise RuntimeError(cvar.ff)
if cvar.gg != "I'm a \"raw UTF-8\" \\ string.":
- raise RuntimeError, cvar.gg
+ raise RuntimeError(cvar.gg)
def check(got, expected):
diff --git a/Examples/test-suite/python/cpp11_result_of_runme.py b/Examples/test-suite/python/cpp11_result_of_runme.py
index 4469efd81..691d2a2d8 100644
--- a/Examples/test-suite/python/cpp11_result_of_runme.py
+++ b/Examples/test-suite/python/cpp11_result_of_runme.py
@@ -2,10 +2,10 @@ import cpp11_result_of
result = cpp11_result_of.test_result(cpp11_result_of.SQUARE, 3.0)
if result != 9.0:
- raise RuntimeError, "test_result(square, 3.0) is not 9.0. Got: " + str(
- result)
+ raise RuntimeError("test_result(square, 3.0) is not 9.0. Got: " + str(
+ result))
result = cpp11_result_of.test_result_alternative1(cpp11_result_of.SQUARE, 3.0)
if result != 9.0:
- raise RuntimeError, "test_result_alternative1(square, 3.0) is not 9.0. Got: " + str(
- result)
+ raise RuntimeError("test_result_alternative1(square, 3.0) is not 9.0. Got: " + str(
+ result))
diff --git a/Examples/test-suite/python/cpp11_rvalue_reference_runme.py b/Examples/test-suite/python/cpp11_rvalue_reference_runme.py
index c1cd3bf26..85d64a581 100644
--- a/Examples/test-suite/python/cpp11_rvalue_reference_runme.py
+++ b/Examples/test-suite/python/cpp11_rvalue_reference_runme.py
@@ -4,24 +4,24 @@ a = cpp11_rvalue_reference.A()
a.setAcopy(5)
if a.getAcopy() != 5:
- raise RunTimeError, ("int A::getAcopy() value is ",
+ raise RunTimeError("int A::getAcopy() value is ",
a.getAcopy(), " should be 5")
ptr = a.getAptr()
a.setAptr(ptr)
if a.getAcopy() != 5:
- raise RunTimeError, ("after A::setAptr(): int A::getAcopy() value is ", a.getAcopy(
+ raise RunTimeError("after A::setAptr(): int A::getAcopy() value is ", a.getAcopy(
), " should be 5")
a.setAref(ptr)
if a.getAcopy() != 5:
- raise RunTimeError, ("after A::setAref(): int A::getAcopy() value is ", a.getAcopy(
+ raise RunTimeError("after A::setAref(): int A::getAcopy() value is ", a.getAcopy(
), " should be 5")
rvalueref = a.getAmove()
a.setAmove(rvalueref)
if a.getAcopy() != 5:
- raise RunTimeError, ("after A::setAmove(): int A::getAcopy() value is ", a.getAcopy(
+ raise RunTimeError("after A::setAmove(): int A::getAcopy() value is ", a.getAcopy(
), " should be 5")
diff --git a/Examples/test-suite/python/cpp11_std_array_runme.py b/Examples/test-suite/python/cpp11_std_array_runme.py
index e5e7373dd..9e11a3e5b 100644
--- a/Examples/test-suite/python/cpp11_std_array_runme.py
+++ b/Examples/test-suite/python/cpp11_std_array_runme.py
@@ -3,7 +3,7 @@ import sys
def failed(a, b, msg):
- raise RuntimeError, msg + " " + str(list(a)) + " " + str(list(b))
+ raise RuntimeError(msg + " " + str(list(a)) + " " + str(list(b)))
def compare_sequences(a, b):
@@ -26,8 +26,8 @@ def steps_exception(swigarray, i, j, step):
a = swigarray[i::step]
else:
a = swigarray[i:j:step]
- raise RuntimeError, "swigarray[" + str(i) + ":" + str(j) + ":" + str(step) + "] missed steps exception for " + str(list(swigarray))
- except ValueError, e:
+ raise RuntimeError("swigarray[" + str(i) + ":" + str(j) + ":" + str(step) + "] missed steps exception for " + str(list(swigarray)))
+ except ValueError as e:
# print("exception: {}".format(e))
pass
@@ -43,16 +43,16 @@ def del_exception(swigarray, i, j, step):
del swigarray[i::step]
else:
del swigarray[i:j:step]
- raise RuntimeError, "swigarray[" + str(i) + ":" + str(j) + ":" + str(step) + "] missed del exception for " + str(list(swigarray))
- except ValueError, e:
+ raise RuntimeError("swigarray[" + str(i) + ":" + str(j) + ":" + str(step) + "] missed del exception for " + str(list(swigarray)))
+ except ValueError as e:
# print("exception: {}".format(e))
pass
def setslice_exception(swigarray, newval):
try:
swigarray[::] = newval
- raise RuntimeError, "swigarray[::] = " + str(newval) + " missed set exception for swigarray:" + str(list(swigarray))
- except TypeError, e:
+ raise RuntimeError("swigarray[::] = " + str(newval) + " missed set exception for swigarray:" + str(list(swigarray)))
+ except TypeError as e:
# print("exception: {}".format(e))
pass
diff --git a/Examples/test-suite/python/cpp11_uniform_initialization_runme.py b/Examples/test-suite/python/cpp11_uniform_initialization_runme.py
index ecb468ccb..b01557a6f 100644
--- a/Examples/test-suite/python/cpp11_uniform_initialization_runme.py
+++ b/Examples/test-suite/python/cpp11_uniform_initialization_runme.py
@@ -9,13 +9,13 @@ if var2.getX() != 2:
m = cpp11_uniform_initialization.MoreInit()
if m.charptr != None:
- raise RuntimeError, m.charptr
+ raise RuntimeError(m.charptr)
m.charptr = "hello sir"
if m.charptr != "hello sir":
- raise RuntimeError, m.charptr
+ raise RuntimeError(m.charptr)
if m.more1(m.vi) != 15:
- raise RuntimeError, m.vi
+ raise RuntimeError(m.vi)
if m.more1([-1, 1, 2]) != 2:
- raise RuntimeError, m.vi
+ raise RuntimeError(m.vi)
if m.more1() != 10:
raise RuntimeError
diff --git a/Examples/test-suite/python/director_abstract_runme.py b/Examples/test-suite/python/director_abstract_runme.py
index 333b75fe5..c8c4b36dc 100644
--- a/Examples/test-suite/python/director_abstract_runme.py
+++ b/Examples/test-suite/python/director_abstract_runme.py
@@ -13,10 +13,10 @@ class MyFoo(director_abstract.Foo):
a = MyFoo()
if a.ping() != "MyFoo::ping()":
- raise RuntimeError, a.ping()
+ raise RuntimeError(a.ping())
if a.pong() != "Foo::pong();MyFoo::ping()":
- raise RuntimeError, a.pong()
+ raise RuntimeError(a.pong())
class MyExample1(director_abstract.Example1):
diff --git a/Examples/test-suite/python/director_alternating_runme.py b/Examples/test-suite/python/director_alternating_runme.py
index a93ffec34..dc85351b5 100644
--- a/Examples/test-suite/python/director_alternating_runme.py
+++ b/Examples/test-suite/python/director_alternating_runme.py
@@ -2,4 +2,4 @@ from director_alternating import *
id = getBar().id()
if id != idFromGetBar():
- raise RuntimeError, "Got wrong id: " + str(id)
+ raise RuntimeError("Got wrong id: " + str(id))
diff --git a/Examples/test-suite/python/director_basic_runme.py b/Examples/test-suite/python/director_basic_runme.py
index 6564c95a2..79cd0e2eb 100644
--- a/Examples/test-suite/python/director_basic_runme.py
+++ b/Examples/test-suite/python/director_basic_runme.py
@@ -10,18 +10,18 @@ class PyFoo(director_basic.Foo):
a = PyFoo()
if a.ping() != "PyFoo::ping()":
- raise RuntimeError, a.ping()
+ raise RuntimeError(a.ping())
if a.pong() != "Foo::pong();PyFoo::ping()":
- raise RuntimeError, a.pong()
+ raise RuntimeError(a.pong())
b = director_basic.Foo()
if b.ping() != "Foo::ping()":
- raise RuntimeError, b.ping()
+ raise RuntimeError(b.ping())
if b.pong() != "Foo::pong();Foo::ping()":
- raise RuntimeError, b.pong()
+ raise RuntimeError(b.pong())
a = director_basic.A1(1)
diff --git a/Examples/test-suite/python/director_comparison_operators_runme.py b/Examples/test-suite/python/director_comparison_operators_runme.py
index 4fe733098..e9bf9438d 100644
--- a/Examples/test-suite/python/director_comparison_operators_runme.py
+++ b/Examples/test-suite/python/director_comparison_operators_runme.py
@@ -8,4 +8,4 @@ class PyFoo(director_comparison_operators.Foo):
a = PyFoo()
if a.test() != "a=1,b=2":
- raise RuntimeError, a.test()
+ raise RuntimeError(a.test())
diff --git a/Examples/test-suite/python/director_detect_runme.py b/Examples/test-suite/python/director_detect_runme.py
index 345051982..b9c73eb45 100644
--- a/Examples/test-suite/python/director_detect_runme.py
+++ b/Examples/test-suite/python/director_detect_runme.py
@@ -35,4 +35,4 @@ c = b.clone()
vc = c.get_value()
if (v != 3) or (b.val != 5) or (vc != 6):
- raise RuntimeError, "Bad virtual detection"
+ raise RuntimeError("Bad virtual detection")
diff --git a/Examples/test-suite/python/director_exception_runme.py b/Examples/test-suite/python/director_exception_runme.py
index 77abd25a9..458983c6a 100644
--- a/Examples/test-suite/python/director_exception_runme.py
+++ b/Examples/test-suite/python/director_exception_runme.py
@@ -10,7 +10,7 @@ class MyException(Exception):
class MyFoo(Foo):
def ping(self):
- raise NotImplementedError, "MyFoo::ping() EXCEPTION"
+ raise NotImplementedError("MyFoo::ping() EXCEPTION")
class MyFoo2(Foo):
@@ -39,7 +39,7 @@ b = launder(a)
try:
b.pong()
raise RuntimeError("Exception was not thrown")
-except NotImplementedError, e:
+except NotImplementedError as e:
if not str(e) == "MyFoo::ping() EXCEPTION":
raise RuntimeError("Unexpected error message: %s" % str(e))
except TypeError:
@@ -53,7 +53,7 @@ b = launder(a)
try:
b.pong()
raise RuntimeError("Exception was not thrown")
-except TypeError, e:
+except TypeError as e:
# fastdispatch mode adds on Additional Information to the exception message - just check the main exception message exists
if not str(e).startswith("SWIG director type mismatch in output value of type 'std::string'"):
raise RuntimeError("Unexpected error message: %s" % str(e))
@@ -66,7 +66,7 @@ b = launder(a)
try:
b.pong()
raise RuntimeError("Exception was not thrown")
-except MyException, e:
+except MyException as e:
if e.msg != "foobar":
raise RuntimeError("Unexpected error message: %s" % str(e))
diff --git a/Examples/test-suite/python/director_extend_runme.py b/Examples/test-suite/python/director_extend_runme.py
index a5aad8245..870443d1f 100644
--- a/Examples/test-suite/python/director_extend_runme.py
+++ b/Examples/test-suite/python/director_extend_runme.py
@@ -17,6 +17,6 @@ class MyObject(SpObject):
m = MyObject()
if m.dummy() != 666:
- raise RuntimeError, "1st call"
+ raise RuntimeError("1st call")
if m.dummy() != 666: # Locked system
- raise RuntimeError, "2nd call"
+ raise RuntimeError("2nd call")
diff --git a/Examples/test-suite/python/director_frob_runme.py b/Examples/test-suite/python/director_frob_runme.py
index 0ef4ad900..6c8fcad06 100644
--- a/Examples/test-suite/python/director_frob_runme.py
+++ b/Examples/test-suite/python/director_frob_runme.py
@@ -4,4 +4,4 @@ foo = Bravo()
s = foo.abs_method()
if s != "Bravo::abs_method()":
- raise RuntimeError, s
+ raise RuntimeError(s)
diff --git a/Examples/test-suite/python/director_nested_runme.py b/Examples/test-suite/python/director_nested_runme.py
index f3d973630..b2c4b0d40 100644
--- a/Examples/test-suite/python/director_nested_runme.py
+++ b/Examples/test-suite/python/director_nested_runme.py
@@ -14,7 +14,7 @@ class A(FooBar_int):
a = A()
if a.step() != "Bar::step;Foo::advance;Bar::do_advance;A::do_step;":
- raise RuntimeError, "Bad A virtual resolution"
+ raise RuntimeError("Bad A virtual resolution")
class B(FooBar_int):
@@ -34,7 +34,7 @@ class B(FooBar_int):
b = B()
if b.step() != "Bar::step;Foo::advance;B::do_advance;B::do_step;":
- raise RuntimeError, "Bad B virtual resolution"
+ raise RuntimeError("Bad B virtual resolution")
class C(FooBar_int):
diff --git a/Examples/test-suite/python/director_protected_runme.py b/Examples/test-suite/python/director_protected_runme.py
index c3118a7c0..94eab69a6 100644
--- a/Examples/test-suite/python/director_protected_runme.py
+++ b/Examples/test-suite/python/director_protected_runme.py
@@ -35,7 +35,7 @@ try:
raise RuntimeError
pass
except:
- raise RuntimeError, "bad FooBar::used"
+ raise RuntimeError("bad FooBar::used")
try:
s = fb2.used()
@@ -43,7 +43,7 @@ try:
raise RuntimeError
pass
except:
- raise RuntimeError, "bad FooBar2::used"
+ raise RuntimeError("bad FooBar2::used")
try:
s = b.pong()
@@ -51,7 +51,7 @@ try:
raise RuntimeError
pass
except:
- raise RuntimeError, "bad Bar::pong"
+ raise RuntimeError("bad Bar::pong")
try:
s = f.pong()
@@ -59,7 +59,7 @@ try:
raise RuntimeError
pass
except:
- raise RuntimeError, " bad Foo::pong"
+ raise RuntimeError(" bad Foo::pong")
try:
s = fb.pong()
@@ -67,7 +67,7 @@ try:
raise RuntimeError
pass
except:
- raise RuntimeError, " bad FooBar::pong"
+ raise RuntimeError(" bad FooBar::pong")
protected = 1
try:
@@ -76,7 +76,7 @@ try:
except:
pass
if not protected:
- raise RuntimeError, "Foo::ping is protected"
+ raise RuntimeError("Foo::ping is protected")
protected = 1
try:
@@ -85,7 +85,7 @@ try:
except:
pass
if not protected:
- raise RuntimeError, "Foo::ping is protected"
+ raise RuntimeError("Foo::ping is protected")
protected = 1
@@ -95,7 +95,7 @@ try:
except:
pass
if not protected:
- raise RuntimeError, "FooBar::pang is protected"
+ raise RuntimeError("FooBar::pang is protected")
protected = 1
@@ -105,7 +105,7 @@ try:
except:
pass
if not protected:
- raise RuntimeError, "Bar::cheer is protected"
+ raise RuntimeError("Bar::cheer is protected")
protected = 1
try:
@@ -114,19 +114,19 @@ try:
except:
pass
if not protected:
- raise RuntimeError, "Foo::cheer is protected"
+ raise RuntimeError("Foo::cheer is protected")
if fb3.cheer() != "FooBar3::cheer();":
- raise RuntimeError, "bad fb3::cheer"
+ raise RuntimeError("bad fb3::cheer")
if fb2.callping() != "FooBar2::ping();":
- raise RuntimeError, "bad fb2.callping"
+ raise RuntimeError("bad fb2.callping")
if fb2.callcheer() != "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();":
- raise RuntimeError, "bad fb2.callcheer"
+ raise RuntimeError("bad fb2.callcheer")
if fb3.callping() != "Bar::ping();":
- raise RuntimeError, "bad fb3.callping"
+ raise RuntimeError("bad fb3.callping")
if fb3.callcheer() != "FooBar3::cheer();":
- raise RuntimeError, "bad fb3.callcheer"
+ raise RuntimeError("bad fb3.callcheer")
diff --git a/Examples/test-suite/python/director_smartptr_runme.py b/Examples/test-suite/python/director_smartptr_runme.py
index 23e22d0fb..b4cbafe32 100644
--- a/Examples/test-suite/python/director_smartptr_runme.py
+++ b/Examples/test-suite/python/director_smartptr_runme.py
@@ -31,7 +31,7 @@ class director_smartptr_MyBarFooDerived(FooDerived):
def check(got, expected):
if (got != expected):
- raise RuntimeError, "Failed, got: " + got + " expected: " + expected
+ raise RuntimeError("Failed, got: " + got + " expected: " + expected)
fooBar = FooBar()
diff --git a/Examples/test-suite/python/exception_order_runme.py b/Examples/test-suite/python/exception_order_runme.py
index aa97e26e6..5c1529999 100644
--- a/Examples/test-suite/python/exception_order_runme.py
+++ b/Examples/test-suite/python/exception_order_runme.py
@@ -9,35 +9,35 @@ a = A()
try:
a.foo()
-except E1, e:
+except E1 as e:
pass
except:
- raise RuntimeError, "bad exception order"
+ raise RuntimeError("bad exception order")
try:
a.bar()
-except E2, e:
+except E2 as e:
pass
except:
- raise RuntimeError, "bad exception order"
+ raise RuntimeError("bad exception order")
try:
a.foobar()
-except RuntimeError, e:
+except RuntimeError as e:
if e.args[0] != "postcatch unknown":
raise RuntimeError("bad exception order {}".format(e.args))
try:
a.barfoo(1)
-except E1, e:
+except E1 as e:
pass
except:
- raise RuntimeError, "bad exception order"
+ raise RuntimeError("bad exception order")
try:
a.barfoo(2)
-except E2, e:
+except E2 as e:
pass
except:
- raise RuntimeError, "bad exception order"
+ raise RuntimeError("bad exception order")
diff --git a/Examples/test-suite/python/fvirtual_runme.py b/Examples/test-suite/python/fvirtual_runme.py
index 99f5dc6b0..fe211b441 100644
--- a/Examples/test-suite/python/fvirtual_runme.py
+++ b/Examples/test-suite/python/fvirtual_runme.py
@@ -5,4 +5,4 @@ n = Node()
i = sw.addChild(n)
if i != 2:
- raise RuntimeError, "addChild"
+ raise RuntimeError("addChild")
diff --git a/Examples/test-suite/python/global_functions_runme.py b/Examples/test-suite/python/global_functions_runme.py
index f411261b6..4aab1b082 100644
--- a/Examples/test-suite/python/global_functions_runme.py
+++ b/Examples/test-suite/python/global_functions_runme.py
@@ -11,7 +11,7 @@ check(global_two(2, 2), 4)
fail = True
try:
global_void(1)
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
@@ -19,7 +19,7 @@ if fail:
fail = True
try:
global_one()
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
@@ -27,7 +27,7 @@ if fail:
fail = True
try:
global_one(2, 2)
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
@@ -36,7 +36,7 @@ if fail:
fail = True
try:
global_two(1)
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
@@ -45,7 +45,7 @@ if fail:
fail = True
try:
global_two(3, 3, 3)
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
diff --git a/Examples/test-suite/python/global_vars_runme.py b/Examples/test-suite/python/global_vars_runme.py
index 3ef0b494f..015519ec8 100644
--- a/Examples/test-suite/python/global_vars_runme.py
+++ b/Examples/test-suite/python/global_vars_runme.py
@@ -20,7 +20,7 @@ if x != 9876:
fail = True
try:
global_vars.cvar.notexist = "something"
-except AttributeError, e:
+except AttributeError as e:
fail = False
if fail:
raise RuntimeError("AttributeError should have been thrown")
@@ -28,7 +28,7 @@ if fail:
fail = True
try:
g = global_vars.cvar.notexist
-except AttributeError, e:
+except AttributeError as e:
fail = False
if fail:
raise RuntimeError("AttributeError should have been thrown")
diff --git a/Examples/test-suite/python/import_stl_runme.py b/Examples/test-suite/python/import_stl_runme.py
index 69fe812b9..d0efbd083 100644
--- a/Examples/test-suite/python/import_stl_runme.py
+++ b/Examples/test-suite/python/import_stl_runme.py
@@ -3,4 +3,4 @@ import import_stl_a
v_new = import_stl_b.process_vector([1, 2, 3])
if v_new != (1, 2, 3, 4):
- raise RuntimeError, v_new
+ raise RuntimeError(v_new)
diff --git a/Examples/test-suite/python/li_attribute_runme.py b/Examples/test-suite/python/li_attribute_runme.py
index 764bcdb55..a5a6914cd 100644
--- a/Examples/test-suite/python/li_attribute_runme.py
+++ b/Examples/test-suite/python/li_attribute_runme.py
@@ -75,7 +75,7 @@ if myStringyClass.ReadOnlyString != "changed string":
try:
x = myFoo.does_not_exist
raise RuntimeError
-except AttributeError, e:
+except AttributeError as e:
if str(e).find("does_not_exist") == -1:
raise RuntimeError
diff --git a/Examples/test-suite/python/li_boost_shared_ptr_runme.py b/Examples/test-suite/python/li_boost_shared_ptr_runme.py
index c960625ad..ecda7fdb1 100644
--- a/Examples/test-suite/python/li_boost_shared_ptr_runme.py
+++ b/Examples/test-suite/python/li_boost_shared_ptr_runme.py
@@ -10,7 +10,7 @@ class li_boost_shared_ptr_runme:
def main(self):
if (debug):
- print "Started"
+ print("Started")
li_boost_shared_ptr.cvar.debug_shared = debug
@@ -32,7 +32,7 @@ class li_boost_shared_ptr_runme:
"shared_ptr wrapper count=%s" % wrapper_count)
if (debug):
- print "Finished"
+ print("Finished")
def runtest(self):
# simple shared_ptr usage - created in C++
diff --git a/Examples/test-suite/python/li_implicit_runme.py b/Examples/test-suite/python/li_implicit_runme.py
index d8dd0fdcc..5d5c6caa0 100644
--- a/Examples/test-suite/python/li_implicit_runme.py
+++ b/Examples/test-suite/python/li_implicit_runme.py
@@ -9,8 +9,8 @@ ad, get(ad)
ab, get(ab)
if get(ai) != get(1):
- raise RuntimeError, "bad implicit type"
+ raise RuntimeError("bad implicit type")
if get(ad) != get(2.0):
- raise RuntimeError, "bad implicit type"
+ raise RuntimeError("bad implicit type")
if get(ab) != get(b):
- raise RuntimeError, "bad implicit type"
+ raise RuntimeError("bad implicit type")
diff --git a/Examples/test-suite/python/li_std_containers_int_runme.py b/Examples/test-suite/python/li_std_containers_int_runme.py
index 941838a5f..f346de220 100644
--- a/Examples/test-suite/python/li_std_containers_int_runme.py
+++ b/Examples/test-suite/python/li_std_containers_int_runme.py
@@ -6,7 +6,7 @@ import sys
def failed(a, b, msg):
- raise RuntimeError, msg + " " + str(list(a)) + " " + str(list(b))
+ raise RuntimeError(msg + " " + str(list(a)) + " " + str(list(b)))
def compare_sequences(a, b):
@@ -26,7 +26,7 @@ def compare_containers(pythonlist, swigvector, swiglist):
def container_insert_step(i, j, step, newval):
- ps = range(6)
+ ps = list(range(6))
iv = vector_int(ps)
il = list_int(ps)
@@ -43,9 +43,9 @@ def container_insert_step(i, j, step, newval):
else:
ps[i:j:step] = newval
ps_error = None
- except ValueError, e:
+ except ValueError as e:
ps_error = e
- except IndexError, e:
+ except IndexError as e:
ps_error = e
# std::vector<int>
@@ -61,9 +61,9 @@ def container_insert_step(i, j, step, newval):
else:
iv[i:j:step] = newval
iv_error = None
- except ValueError, e:
+ except ValueError as e:
iv_error = e
- except IndexError, e:
+ except IndexError as e:
iv_error = e
# std::list<int>
@@ -79,14 +79,14 @@ def container_insert_step(i, j, step, newval):
else:
il[i:j:step] = newval
il_error = None
- except ValueError, e:
+ except ValueError as e:
il_error = e
- except IndexError, e:
+ except IndexError as e:
il_error = e
if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
- raise RuntimeError, "ValueError exception not consistently thrown: " + \
- str(ps_error) + " " + str(iv_error) + " " + str(il_error)
+ raise RuntimeError("ValueError exception not consistently thrown: " + \
+ str(ps_error) + " " + str(iv_error) + " " + str(il_error))
compare_containers(ps, iv, il)
@@ -94,7 +94,7 @@ def container_insert_step(i, j, step, newval):
# Check std::vector and std::list delete behaves same as Python list
# delete including exceptions
def container_delete_step(i, j, step):
- ps = range(6)
+ ps = list(range(6))
iv = vector_int(ps)
il = list_int(ps)
@@ -111,9 +111,9 @@ def container_delete_step(i, j, step):
else:
del ps[i:j:step]
ps_error = None
- except ValueError, e:
+ except ValueError as e:
ps_error = e
- except IndexError, e:
+ except IndexError as e:
ps_error = e
# std::vector<int>
@@ -129,9 +129,9 @@ def container_delete_step(i, j, step):
else:
del iv[i:j:step]
iv_error = None
- except ValueError, e:
+ except ValueError as e:
iv_error = e
- except IndexError, e:
+ except IndexError as e:
iv_error = e
# std::list<int>
@@ -147,14 +147,14 @@ def container_delete_step(i, j, step):
else:
del il[i:j:step]
il_error = None
- except ValueError, e:
+ except ValueError as e:
il_error = e
- except IndexError, e:
+ except IndexError as e:
il_error = e
if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
- raise RuntimeError, "ValueError exception not consistently thrown: " + \
- str(ps_error) + " " + str(iv_error) + " " + str(il_error)
+ raise RuntimeError("ValueError exception not consistently thrown: " + \
+ str(ps_error) + " " + str(iv_error) + " " + str(il_error))
compare_containers(ps, iv, il)
@@ -252,7 +252,7 @@ for start in [-102, -100, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 10
for step in range(-7, 7):
container_delete_step(start, end, step)
-ps = range(6)
+ps = list(range(6))
iv = vector_int(ps)
il = list_int(ps)
del ps[:]
diff --git a/Examples/test-suite/python/li_std_map_runme.py b/Examples/test-suite/python/li_std_map_runme.py
index f53d3f56b..765527ea4 100644
--- a/Examples/test-suite/python/li_std_map_runme.py
+++ b/Examples/test-suite/python/li_std_map_runme.py
@@ -50,31 +50,31 @@ mii[1] = 2
if mii[1] != 2:
raise RuntimeError
-if mii.keys() != [1]:
+if list(mii.keys()) != [1]:
raise RuntimeError("keys")
-if mii.values() != [2]:
+if list(mii.values()) != [2]:
raise RuntimeError("values")
-if mii.items() != [(1, 2)]:
+if list(mii.items()) != [(1, 2)]:
raise RuntimeError("items")
if [k for k in mii] != [1]:
raise RuntimeError("iteration")
-if [i for i in mii.iterkeys()] != [1]:
+if [i for i in mii.keys()] != [1]:
raise RuntimeError("iterkeys")
-if [i for i in mii.itervalues()] != [2]:
+if [i for i in mii.values()] != [2]:
raise RuntimeError("itervalues")
-if [i for i in mii.iteritems()] != [(1, 2)]:
+if [i for i in mii.items()] != [(1, 2)]:
raise RuntimeError("iteritems")
slmap = li_std_map.StringLengthNumberMap()
li_std_map.populate(slmap)
-keys = " ".join([k for k in slmap.keys()])
+keys = " ".join([k for k in list(slmap.keys())])
if keys != "a aa zzz xxxx aaaaa":
raise RuntimeError("Keys are wrong or in wrong order: " + keys)
-values = " ".join([str(v) for v in slmap.values()])
+values = " ".join([str(v) for v in list(slmap.values())])
if values != "1 2 3 4 5":
raise RuntimeError("Values are wrong or in wrong order: " + values)
diff --git a/Examples/test-suite/python/li_std_set_runme.py b/Examples/test-suite/python/li_std_set_runme.py
index 5e5b72442..34a1eb19c 100644
--- a/Examples/test-suite/python/li_std_set_runme.py
+++ b/Examples/test-suite/python/li_std_set_runme.py
@@ -14,11 +14,11 @@ if sum != "abc":
raise RuntimeError
i = s.__iter__()
-if i.next() != "a":
+if next(i) != "a":
raise RuntimeError
-if i.next() != "b":
+if next(i) != "b":
raise RuntimeError
-if i.next() != "c":
+if next(i) != "c":
raise RuntimeError
@@ -26,7 +26,7 @@ b = s.begin()
e = s.end()
sum = ""
while (b != e):
- sum = sum + b.next()
+ sum = sum + next(b)
if sum != "abc":
raise RuntimeError
@@ -34,7 +34,7 @@ b = s.rbegin()
e = s.rend()
sum = ""
while (b != e):
- sum = sum + b.next()
+ sum = sum + next(b)
if sum != "cba":
raise RuntimeError
@@ -47,25 +47,25 @@ si.append(2)
si.append(3)
i = si.__iter__()
-if i.next() != 1:
+if next(i) != 1:
raise RuntimeError
-if i.next() != 2:
+if next(i) != 2:
raise RuntimeError
-if i.next() != 3:
+if next(i) != 3:
raise RuntimeError
if si[0] != 1:
raise RuntimeError
i = s.begin()
-i.next()
+next(i)
s.erase(i)
b = s.begin()
e = s.end()
sum = ""
while (b != e):
- sum = sum + b.next()
+ sum = sum + next(b)
if sum != "ac":
raise RuntimeError
diff --git a/Examples/test-suite/python/li_std_string_extra_runme.py b/Examples/test-suite/python/li_std_string_extra_runme.py
index 9d3bad03a..96c64163d 100644
--- a/Examples/test-suite/python/li_std_string_extra_runme.py
+++ b/Examples/test-suite/python/li_std_string_extra_runme.py
@@ -4,16 +4,16 @@ x = "hello"
if li_std_string_extra.test_ccvalue(x) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_cvalue(x) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_value(x) != x:
raise RuntimeError("bad string mapping {} {}".format(x, li_std_string_extra.test_value(x)))
if li_std_string_extra.test_const_reference(x) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
s = li_std_string_extra.string("he")
@@ -25,21 +25,21 @@ if s != x:
raise RuntimeError("bad string mapping {} {}".format(s, x))
if s[1:4] != x[1:4]:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_value(s) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_const_reference(s) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
a = li_std_string_extra.A(s)
if li_std_string_extra.test_value(a) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_const_reference(a) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
b = li_std_string_extra.string(" world")
@@ -48,17 +48,17 @@ if a + b != "hello world":
raise RuntimeError("bad string mapping {}".format(a + b))
if a + " world" != "hello world":
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
# This is expected to fail with -builtin option
# Reverse operators not supported in builtin types
if not li_std_string_extra.is_python_builtin():
if "hello" + b != "hello world":
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
c = "hello" + b
if c.find_last_of("l") != 9:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
s = "hello world"
@@ -66,33 +66,33 @@ b = li_std_string_extra.B("hi")
b.name = li_std_string_extra.string("hello")
if b.name != "hello":
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
b.a = li_std_string_extra.A("hello")
if b.a != "hello":
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_value_basic1(x) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_value_basic2(x) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_value_basic3(x) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_value_basic_overload(x) != x:
- raise RuntimeError, "bad overload string"
+ raise RuntimeError("bad overload string")
if li_std_string_extra.test_value_basic_overload(123) != "int":
- raise RuntimeError, "bad overload int"
+ raise RuntimeError("bad overload int")
try:
li_std_string_extra.test_value_basic_overload([x])
- raise RuntimeError, "should throw TypeError"
+ raise RuntimeError("should throw TypeError")
except TypeError as e:
if str(e).find("Possible C/C++ prototypes are:") == -1:
raise RuntimeError("Incorrect error message text:\n{}".format(e))
@@ -100,7 +100,7 @@ except TypeError as e:
try:
li_std_string_extra.test_value_basic_overload([123])
- raise RuntimeError, "should throw TypeError"
+ raise RuntimeError("should throw TypeError")
except TypeError as e:
if str(e).find("Possible C/C++ prototypes are:") == -1:
raise RuntimeError("Incorrect error message text:\n{}".format(e))
@@ -109,30 +109,30 @@ except TypeError as e:
# Global variables
s = "initial string"
if li_std_string_extra.cvar.GlobalString2 != "global string 2":
- raise RuntimeError, "GlobalString2 test 1"
+ raise RuntimeError("GlobalString2 test 1")
li_std_string_extra.cvar.GlobalString2 = s
if li_std_string_extra.cvar.GlobalString2 != s:
- raise RuntimeError, "GlobalString2 test 2"
+ raise RuntimeError("GlobalString2 test 2")
if li_std_string_extra.cvar.ConstGlobalString != "const global string":
- raise RuntimeError, "ConstGlobalString test"
+ raise RuntimeError("ConstGlobalString test")
# Member variables
myStructure = li_std_string_extra.Structure()
if myStructure.MemberString2 != "member string 2":
- raise RuntimeError, "MemberString2 test 1"
+ raise RuntimeError("MemberString2 test 1")
myStructure.MemberString2 = s
if myStructure.MemberString2 != s:
- raise RuntimeError, "MemberString2 test 2"
+ raise RuntimeError("MemberString2 test 2")
if myStructure.ConstMemberString != "const member string":
- raise RuntimeError, "ConstMemberString test"
+ raise RuntimeError("ConstMemberString test")
if li_std_string_extra.cvar.Structure_StaticMemberString2 != "static member string 2":
- raise RuntimeError, "StaticMemberString2 test 1"
+ raise RuntimeError("StaticMemberString2 test 1")
li_std_string_extra.cvar.Structure_StaticMemberString2 = s
if li_std_string_extra.cvar.Structure_StaticMemberString2 != s:
- raise RuntimeError, "StaticMemberString2 test 2"
+ raise RuntimeError("StaticMemberString2 test 2")
if li_std_string_extra.cvar.Structure_ConstStaticMemberString != "const static member string":
- raise RuntimeError, "ConstStaticMemberString test"
+ raise RuntimeError("ConstStaticMemberString test")
if li_std_string_extra.test_reference_input("hello") != "hello":
diff --git a/Examples/test-suite/python/li_std_vector_enum_runme.py b/Examples/test-suite/python/li_std_vector_enum_runme.py
index 318d1bff6..587f20b37 100644
--- a/Examples/test-suite/python/li_std_vector_enum_runme.py
+++ b/Examples/test-suite/python/li_std_vector_enum_runme.py
@@ -14,7 +14,7 @@ check(ev.nums[2], 30)
it = ev.nums.iterator()
v = it.value()
check(v, 10)
-it.next()
+next(it)
v = it.value()
check(v, 20)
diff --git a/Examples/test-suite/python/li_std_vector_extra_runme.py b/Examples/test-suite/python/li_std_vector_extra_runme.py
index 59e729a27..40444552b 100644
--- a/Examples/test-suite/python/li_std_vector_extra_runme.py
+++ b/Examples/test-suite/python/li_std_vector_extra_runme.py
@@ -23,20 +23,20 @@ bv[2] = bool(4)
bv[3] = bool(0)
if bv[0] != bv[2]:
- raise RuntimeError, "bad std::vector<bool> mapping"
+ raise RuntimeError("bad std::vector<bool> mapping")
b = B(5)
va = VecA([b, None, b, b])
if va[0].f(1) != 6:
- raise RuntimeError, "bad std::vector<A*> mapping"
+ raise RuntimeError("bad std::vector<A*> mapping")
if vecAptr(va) != 6:
- raise RuntimeError, "bad std::vector<A*> mapping"
+ raise RuntimeError("bad std::vector<A*> mapping")
b.val = 7
if va[3].f(1) != 8:
- raise RuntimeError, "bad std::vector<A*> mapping"
+ raise RuntimeError("bad std::vector<A*> mapping")
ip = PtrInt()
@@ -47,7 +47,7 @@ ArrInt_setitem(ap, 2, 123)
vi = IntPtrVector((ip, ap, None))
if ArrInt_getitem(vi[0], 0) != ArrInt_getitem(vi[1], 2):
- raise RuntimeError, "bad std::vector<int*> mapping"
+ raise RuntimeError("bad std::vector<int*> mapping")
delete_ArrInt(ap)
@@ -57,42 +57,42 @@ a = halfs([10, 8, 4, 3])
v = IntVector()
v[0:2] = [1, 2]
if v[0] != 1 or v[1] != 2:
- raise RuntimeError, "bad setslice"
+ raise RuntimeError("bad setslice")
if v[0:-1][0] != 1:
- raise RuntimeError, "bad getslice"
+ raise RuntimeError("bad getslice")
if v[0:-2].size() != 0:
- raise RuntimeError, "bad getslice"
+ raise RuntimeError("bad getslice")
v[0:1] = [2]
if v[0] != 2:
- raise RuntimeError, "bad setslice"
+ raise RuntimeError("bad setslice")
v[1:] = [3]
if v[1] != 3:
- raise RuntimeError, "bad setslice"
+ raise RuntimeError("bad setslice")
v[2:] = [3]
if v[2] != 3:
- raise RuntimeError, "bad setslice"
+ raise RuntimeError("bad setslice")
if v[0:][0] != v[0]:
- raise RuntimeError, "bad getslice"
+ raise RuntimeError("bad getslice")
del v[:]
if v.size() != 0:
- raise RuntimeError, "bad getslice"
+ raise RuntimeError("bad getslice")
del v[:]
if v.size() != 0:
- raise RuntimeError, "bad getslice"
+ raise RuntimeError("bad getslice")
v = vecStr(["hello ", "world"])
if v[0] != "hello world":
- raise RuntimeError, "bad std::string+std::vector"
+ raise RuntimeError("bad std::string+std::vector")
pv = pyvector([1, "hello", (1, 2)])
diff --git a/Examples/test-suite/python/minherit_runme.py b/Examples/test-suite/python/minherit_runme.py
index b7e7d019c..8638d2357 100644
--- a/Examples/test-suite/python/minherit_runme.py
+++ b/Examples/test-suite/python/minherit_runme.py
@@ -7,31 +7,31 @@ c = minherit.FooBar()
d = minherit.Spam()
if a.xget() != 1:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if b.yget() != 2:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if c.xget() != 1 or c.yget() != 2 or c.zget() != 3:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if d.xget() != 1 or d.yget() != 2 or d.zget() != 3 or d.wget() != 4:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if minherit.xget(a) != 1:
- raise RuntimeError, "Bad attribute value %d" % (minherit.xget(a))
+ raise RuntimeError("Bad attribute value %d" % (minherit.xget(a)))
if minherit.yget(b) != 2:
- raise RuntimeError, "Bad attribute value %d" % (minherit.yget(b))
+ raise RuntimeError("Bad attribute value %d" % (minherit.yget(b)))
if minherit.xget(c) != 1 or minherit.yget(c) != 2 or minherit.zget(c) != 3:
- raise RuntimeError, "Bad attribute value %d %d %d" % (
- minherit.xget(c), minherit.yget(c), minherit.zget(c))
+ raise RuntimeError("Bad attribute value %d %d %d" % (
+ minherit.xget(c), minherit.yget(c), minherit.zget(c)))
if minherit.xget(d) != 1 or minherit.yget(d) != 2 or minherit.zget(d) != 3 or minherit.wget(d) != 4:
- raise RuntimeError, "Bad attribute value %d %d %d %d" % (
- minherit.xget(d), minherit.yget(d), minherit.zget(d), minherit.wget(d))
+ raise RuntimeError("Bad attribute value %d %d %d %d" % (
+ minherit.xget(d), minherit.yget(d), minherit.zget(d), minherit.wget(d)))
# Cleanse all of the pointers and see what happens
@@ -41,27 +41,27 @@ cc = minherit.toFooBarPtr(c)
dd = minherit.toSpamPtr(d)
if aa.xget() != 1:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if bb.yget() != 2:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if cc.xget() != 1 or cc.yget() != 2 or cc.zget() != 3:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if dd.xget() != 1 or dd.yget() != 2 or dd.zget() != 3 or dd.wget() != 4:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if minherit.xget(aa) != 1:
- raise RuntimeError, "Bad attribute value %d" % (minherit.xget(aa))
+ raise RuntimeError("Bad attribute value %d" % (minherit.xget(aa)))
if minherit.yget(bb) != 2:
- raise RuntimeError, "Bad attribute value %d" % (minherit.yget(bb))
+ raise RuntimeError("Bad attribute value %d" % (minherit.yget(bb)))
if minherit.xget(cc) != 1 or minherit.yget(cc) != 2 or minherit.zget(cc) != 3:
- raise RuntimeError, "Bad attribute value %d %d %d" % (
- minherit.xget(cc), minherit.yget(cc), minherit.zget(cc))
+ raise RuntimeError("Bad attribute value %d %d %d" % (
+ minherit.xget(cc), minherit.yget(cc), minherit.zget(cc)))
if minherit.xget(dd) != 1 or minherit.yget(dd) != 2 or minherit.zget(dd) != 3 or minherit.wget(dd) != 4:
- raise RuntimeError, "Bad attribute value %d %d %d %d" % (
- minherit.xget(dd), minherit.yget(dd), minherit.zget(dd), minherit.wget(dd))
+ raise RuntimeError("Bad attribute value %d %d %d %d" % (
+ minherit.xget(dd), minherit.yget(dd), minherit.zget(dd), minherit.wget(dd)))
diff --git a/Examples/test-suite/python/namespace_class_runme.py b/Examples/test-suite/python/namespace_class_runme.py
index aa5165562..9349f2430 100644
--- a/Examples/test-suite/python/namespace_class_runme.py
+++ b/Examples/test-suite/python/namespace_class_runme.py
@@ -7,7 +7,7 @@ except:
error = 0
if (error):
- raise RuntimeError, "Private1 is private"
+ raise RuntimeError("Private1 is private")
try:
p = Private2()
@@ -16,7 +16,7 @@ except:
error = 0
if (error):
- raise RuntimeError, "Private2 is private"
+ raise RuntimeError("Private2 is private")
EulerT3D.toFrame(1, 1, 1)
diff --git a/Examples/test-suite/python/overload_complicated_runme.py b/Examples/test-suite/python/overload_complicated_runme.py
index 2593c4f16..8794da12b 100644
--- a/Examples/test-suite/python/overload_complicated_runme.py
+++ b/Examples/test-suite/python/overload_complicated_runme.py
@@ -10,38 +10,38 @@ p = Pop(pInt, False)
# Check overloaded in const only and pointers/references which target
# languages cannot disambiguate
if p.hip(False) != 701:
- raise RuntimeError, "Test 1 failed"
+ raise RuntimeError("Test 1 failed")
if p.hip(pInt) != 702:
- raise RuntimeError, "Test 2 failed"
+ raise RuntimeError("Test 2 failed")
# Reverse the order for the above
if p.hop(pInt) != 805:
- raise RuntimeError, "Test 3 failed"
+ raise RuntimeError("Test 3 failed")
if p.hop(False) != 801:
- raise RuntimeError, "Test 4 failed"
+ raise RuntimeError("Test 4 failed")
# Few more variations and order shuffled
if p.pop(False) != 901:
- raise RuntimeError, "Test 5 failed"
+ raise RuntimeError("Test 5 failed")
if p.pop(pInt) != 904:
- raise RuntimeError, "Test 6 failed"
+ raise RuntimeError("Test 6 failed")
if p.pop() != 905:
- raise RuntimeError, "Test 7 failed"
+ raise RuntimeError("Test 7 failed")
# Overload on const only
if p.bop(pInt) != 1001:
- raise RuntimeError, "Test 8 failed"
+ raise RuntimeError("Test 8 failed")
if p.bip(pInt) != 2002:
- raise RuntimeError, "Test 9 failed"
+ raise RuntimeError("Test 9 failed")
# Globals
if muzak(False) != 3001:
- raise RuntimeError, "Test 10 failed"
+ raise RuntimeError("Test 10 failed")
if muzak(pInt) != 3002:
- raise RuntimeError, "Test 11 failed"
+ raise RuntimeError("Test 11 failed")
diff --git a/Examples/test-suite/python/overload_simple_runme.py b/Examples/test-suite/python/overload_simple_runme.py
index 6d72ec081..8ad813b86 100644
--- a/Examples/test-suite/python/overload_simple_runme.py
+++ b/Examples/test-suite/python/overload_simple_runme.py
@@ -1,95 +1,95 @@
from overload_simple import *
if foo(3) != "foo:int":
- raise RuntimeError, "foo(int)"
+ raise RuntimeError("foo(int)")
if foo(3.0) != "foo:double":
- raise RuntimeError, "foo(double)"
+ raise RuntimeError("foo(double)")
if foo("hello") != "foo:char *":
- raise RuntimeError, "foo(char *)"
+ raise RuntimeError("foo(char *)")
f = Foo()
b = Bar()
if foo(f) != "foo:Foo *":
- raise RuntimeError, "foo(Foo *)"
+ raise RuntimeError("foo(Foo *)")
if foo(b) != "foo:Bar *":
- raise RuntimeError, "foo(Bar *)"
+ raise RuntimeError("foo(Bar *)")
v = malloc_void(32)
if foo(v) != "foo:void *":
- raise RuntimeError, "foo(void *)"
+ raise RuntimeError("foo(void *)")
s = Spam()
if s.foo(3) != "foo:int":
- raise RuntimeError, "Spam::foo(int)"
+ raise RuntimeError("Spam::foo(int)")
if s.foo(3.0) != "foo:double":
- raise RuntimeError, "Spam::foo(double)"
+ raise RuntimeError("Spam::foo(double)")
if s.foo("hello") != "foo:char *":
- raise RuntimeError, "Spam::foo(char *)"
+ raise RuntimeError("Spam::foo(char *)")
if s.foo(f) != "foo:Foo *":
- raise RuntimeError, "Spam::foo(Foo *)"
+ raise RuntimeError("Spam::foo(Foo *)")
if s.foo(b) != "foo:Bar *":
- raise RuntimeError, "Spam::foo(Bar *)"
+ raise RuntimeError("Spam::foo(Bar *)")
if s.foo(v) != "foo:void *":
- raise RuntimeError, "Spam::foo(void *)"
+ raise RuntimeError("Spam::foo(void *)")
if Spam_bar(3) != "bar:int":
- raise RuntimeError, "Spam::bar(int)"
+ raise RuntimeError("Spam::bar(int)")
if Spam_bar(3.0) != "bar:double":
- raise RuntimeError, "Spam::bar(double)"
+ raise RuntimeError("Spam::bar(double)")
if Spam_bar("hello") != "bar:char *":
- raise RuntimeError, "Spam::bar(char *)"
+ raise RuntimeError("Spam::bar(char *)")
if Spam_bar(f) != "bar:Foo *":
- raise RuntimeError, "Spam::bar(Foo *)"
+ raise RuntimeError("Spam::bar(Foo *)")
if Spam_bar(b) != "bar:Bar *":
- raise RuntimeError, "Spam::bar(Bar *)"
+ raise RuntimeError("Spam::bar(Bar *)")
if Spam_bar(v) != "bar:void *":
- raise RuntimeError, "Spam::bar(void *)"
+ raise RuntimeError("Spam::bar(void *)")
# Test constructors
s = Spam()
if s.type != "none":
- raise RuntimeError, "Spam()"
+ raise RuntimeError("Spam()")
s = Spam(3)
if s.type != "int":
- raise RuntimeError, "Spam(int)"
+ raise RuntimeError("Spam(int)")
s = Spam(3.4)
if s.type != "double":
- raise RuntimeError, "Spam(double)"
+ raise RuntimeError("Spam(double)")
s = Spam("hello")
if s.type != "char *":
- raise RuntimeError, "Spam(char *)"
+ raise RuntimeError("Spam(char *)")
s = Spam(f)
if s.type != "Foo *":
- raise RuntimeError, "Spam(Foo *)"
+ raise RuntimeError("Spam(Foo *)")
s = Spam(b)
if s.type != "Bar *":
- raise RuntimeError, "Spam(Bar *)"
+ raise RuntimeError("Spam(Bar *)")
s = Spam(v)
if s.type != "void *":
- raise RuntimeError, "Spam(void *)"
+ raise RuntimeError("Spam(void *)")
free_void(v)
diff --git a/Examples/test-suite/python/overload_subtype_runme.py b/Examples/test-suite/python/overload_subtype_runme.py
index 3f32a5583..b02e62ff3 100644
--- a/Examples/test-suite/python/overload_subtype_runme.py
+++ b/Examples/test-suite/python/overload_subtype_runme.py
@@ -4,7 +4,7 @@ f = Foo()
b = Bar()
if spam(f) != 1:
- raise RuntimeError, "foo"
+ raise RuntimeError("foo")
if spam(b) != 2:
- raise RuntimeError, "bar"
+ raise RuntimeError("bar")
diff --git a/Examples/test-suite/python/overload_template_fast_runme.py b/Examples/test-suite/python/overload_template_fast_runme.py
index ca3cac9b5..e4eb33288 100644
--- a/Examples/test-suite/python/overload_template_fast_runme.py
+++ b/Examples/test-suite/python/overload_template_fast_runme.py
@@ -7,74 +7,74 @@ b = maximum(3.4, 5.2)
# mix 1
if (mix1("hi") != 101):
- raise RuntimeError, ("mix1(const char*)")
+ raise RuntimeError(("mix1(const char*)"))
if (mix1(1.0, 1.0) != 102):
- raise RuntimeError, ("mix1(double, const double &)")
+ raise RuntimeError(("mix1(double, const double &)"))
if (mix1(1.0) != 103):
- raise RuntimeError, ("mix1(double)")
+ raise RuntimeError(("mix1(double)"))
# mix 2
if (mix2("hi") != 101):
- raise RuntimeError, ("mix2(const char*)")
+ raise RuntimeError(("mix2(const char*)"))
if (mix2(1.0, 1.0) != 102):
- raise RuntimeError, ("mix2(double, const double &)")
+ raise RuntimeError(("mix2(double, const double &)"))
if (mix2(1.0) != 103):
- raise RuntimeError, ("mix2(double)")
+ raise RuntimeError(("mix2(double)"))
# mix 3
if (mix3("hi") != 101):
- raise RuntimeError, ("mix3(const char*)")
+ raise RuntimeError(("mix3(const char*)"))
if (mix3(1.0, 1.0) != 102):
- raise RuntimeError, ("mix3(double, const double &)")
+ raise RuntimeError(("mix3(double, const double &)"))
if (mix3(1.0) != 103):
- raise RuntimeError, ("mix3(double)")
+ raise RuntimeError(("mix3(double)"))
# Combination 1
if (overtparams1(100) != 10):
- raise RuntimeError, ("overtparams1(int)")
+ raise RuntimeError(("overtparams1(int)"))
if (overtparams1(100.0, 100) != 20):
- raise RuntimeError, ("overtparams1(double, int)")
+ raise RuntimeError(("overtparams1(double, int)"))
# Combination 2
if (overtparams2(100.0, 100) != 40):
- raise RuntimeError, ("overtparams2(double, int)")
+ raise RuntimeError(("overtparams2(double, int)"))
# Combination 3
if (overloaded() != 60):
- raise RuntimeError, ("overloaded()")
+ raise RuntimeError(("overloaded()"))
if (overloaded(100.0, 100) != 70):
- raise RuntimeError, ("overloaded(double, int)")
+ raise RuntimeError(("overloaded(double, int)"))
# Combination 4
if (overloadedagain("hello") != 80):
- raise RuntimeError, ("overloadedagain(const char *)")
+ raise RuntimeError(("overloadedagain(const char *)"))
if (overloadedagain() != 90):
- raise RuntimeError, ("overloadedagain(double)")
+ raise RuntimeError(("overloadedagain(double)"))
# specializations
if (specialization(10) != 202):
- raise RuntimeError, ("specialization(int)")
+ raise RuntimeError(("specialization(int)"))
if (specialization(10.0) != 203):
- raise RuntimeError, ("specialization(double)")
+ raise RuntimeError(("specialization(double)"))
if (specialization(10, 10) != 204):
- raise RuntimeError, ("specialization(int, int)")
+ raise RuntimeError(("specialization(int, int)"))
if (specialization(10.0, 10.0) != 205):
- raise RuntimeError, ("specialization(double, double)")
+ raise RuntimeError(("specialization(double, double)"))
if (specialization("hi", "hi") != 201):
- raise RuntimeError, ("specialization(const char *, const char *)")
+ raise RuntimeError(("specialization(const char *, const char *)"))
# simple specialization
@@ -84,61 +84,61 @@ xyz_double()
# a bit of everything
if (overload("hi") != 0):
- raise RuntimeError, ("overload()")
+ raise RuntimeError(("overload()"))
if (overload(1) != 10):
- raise RuntimeError, ("overload(int t)")
+ raise RuntimeError(("overload(int t)"))
if (overload(1, 1) != 20):
- raise RuntimeError, ("overload(int t, const int &)")
+ raise RuntimeError(("overload(int t, const int &)"))
if (overload(1, "hello") != 30):
- raise RuntimeError, ("overload(int t, const char *)")
+ raise RuntimeError(("overload(int t, const char *)"))
k = Klass()
if (overload(k) != 10):
- raise RuntimeError, ("overload(Klass t)")
+ raise RuntimeError(("overload(Klass t)"))
if (overload(k, k) != 20):
- raise RuntimeError, ("overload(Klass t, const Klass &)")
+ raise RuntimeError(("overload(Klass t, const Klass &)"))
if (overload(k, "hello") != 30):
- raise RuntimeError, ("overload(Klass t, const char *)")
+ raise RuntimeError(("overload(Klass t, const char *)"))
if (overload(10.0, "hi") != 40):
- raise RuntimeError, ("overload(double t, const char *)")
+ raise RuntimeError(("overload(double t, const char *)"))
if (overload() != 50):
- raise RuntimeError, ("overload(const char *)")
+ raise RuntimeError(("overload(const char *)"))
# everything put in a namespace
if (nsoverload("hi") != 1000):
- raise RuntimeError, ("nsoverload()")
+ raise RuntimeError(("nsoverload()"))
if (nsoverload(1) != 1010):
- raise RuntimeError, ("nsoverload(int t)")
+ raise RuntimeError(("nsoverload(int t)"))
if (nsoverload(1, 1) != 1020):
- raise RuntimeError, ("nsoverload(int t, const int &)")
+ raise RuntimeError(("nsoverload(int t, const int &)"))
if (nsoverload(1, "hello") != 1030):
- raise RuntimeError, ("nsoverload(int t, const char *)")
+ raise RuntimeError(("nsoverload(int t, const char *)"))
if (nsoverload(k) != 1010):
- raise RuntimeError, ("nsoverload(Klass t)")
+ raise RuntimeError(("nsoverload(Klass t)"))
if (nsoverload(k, k) != 1020):
- raise RuntimeError, ("nsoverload(Klass t, const Klass &)")
+ raise RuntimeError(("nsoverload(Klass t, const Klass &)"))
if (nsoverload(k, "hello") != 1030):
- raise RuntimeError, ("nsoverload(Klass t, const char *)")
+ raise RuntimeError(("nsoverload(Klass t, const char *)"))
if (nsoverload(10.0, "hi") != 1040):
- raise RuntimeError, ("nsoverload(double t, const char *)")
+ raise RuntimeError(("nsoverload(double t, const char *)"))
if (nsoverload() != 1050):
- raise RuntimeError, ("nsoverload(const char *)")
+ raise RuntimeError(("nsoverload(const char *)"))
A.foo(1)
diff --git a/Examples/test-suite/python/overload_template_runme.py b/Examples/test-suite/python/overload_template_runme.py
index 014ec71cb..a484d8f0e 100644
--- a/Examples/test-suite/python/overload_template_runme.py
+++ b/Examples/test-suite/python/overload_template_runme.py
@@ -6,74 +6,74 @@ b = maximum(3.4, 5.2)
# mix 1
if (mix1("hi") != 101):
- raise RuntimeError, ("mix1(const char*)")
+ raise RuntimeError(("mix1(const char*)"))
if (mix1(1.0, 1.0) != 102):
- raise RuntimeError, ("mix1(double, const double &)")
+ raise RuntimeError(("mix1(double, const double &)"))
if (mix1(1.0) != 103):
- raise RuntimeError, ("mix1(double)")
+ raise RuntimeError(("mix1(double)"))
# mix 2
if (mix2("hi") != 101):
- raise RuntimeError, ("mix2(const char*)")
+ raise RuntimeError(("mix2(const char*)"))
if (mix2(1.0, 1.0) != 102):
- raise RuntimeError, ("mix2(double, const double &)")
+ raise RuntimeError(("mix2(double, const double &)"))
if (mix2(1.0) != 103):
- raise RuntimeError, ("mix2(double)")
+ raise RuntimeError(("mix2(double)"))
# mix 3
if (mix3("hi") != 101):
- raise RuntimeError, ("mix3(const char*)")
+ raise RuntimeError(("mix3(const char*)"))
if (mix3(1.0, 1.0) != 102):
- raise RuntimeError, ("mix3(double, const double &)")
+ raise RuntimeError(("mix3(double, const double &)"))
if (mix3(1.0) != 103):
- raise RuntimeError, ("mix3(double)")
+ raise RuntimeError(("mix3(double)"))
# Combination 1
if (overtparams1(100) != 10):
- raise RuntimeError, ("overtparams1(int)")
+ raise RuntimeError(("overtparams1(int)"))
if (overtparams1(100.0, 100) != 20):
- raise RuntimeError, ("overtparams1(double, int)")
+ raise RuntimeError(("overtparams1(double, int)"))
# Combination 2
if (overtparams2(100.0, 100) != 40):
- raise RuntimeError, ("overtparams2(double, int)")
+ raise RuntimeError(("overtparams2(double, int)"))
# Combination 3
if (overloaded() != 60):
- raise RuntimeError, ("overloaded()")
+ raise RuntimeError(("overloaded()"))
if (overloaded(100.0, 100) != 70):
- raise RuntimeError, ("overloaded(double, int)")
+ raise RuntimeError(("overloaded(double, int)"))
# Combination 4
if (overloadedagain("hello") != 80):
- raise RuntimeError, ("overloadedagain(const char *)")
+ raise RuntimeError(("overloadedagain(const char *)"))
if (overloadedagain() != 90):
- raise RuntimeError, ("overloadedagain(double)")
+ raise RuntimeError(("overloadedagain(double)"))
# specializations
if (specialization(10) != 202):
- raise RuntimeError, ("specialization(int)")
+ raise RuntimeError(("specialization(int)"))
if (specialization(10.0) != 203):
- raise RuntimeError, ("specialization(double)")
+ raise RuntimeError(("specialization(double)"))
if (specialization(10, 10) != 204):
- raise RuntimeError, ("specialization(int, int)")
+ raise RuntimeError(("specialization(int, int)"))
if (specialization(10.0, 10.0) != 205):
- raise RuntimeError, ("specialization(double, double)")
+ raise RuntimeError(("specialization(double, double)"))
if (specialization("hi", "hi") != 201):
- raise RuntimeError, ("specialization(const char *, const char *)")
+ raise RuntimeError(("specialization(const char *, const char *)"))
# simple specialization
@@ -83,61 +83,61 @@ xyz_double()
# a bit of everything
if (overload("hi") != 0):
- raise RuntimeError, ("overload()")
+ raise RuntimeError(("overload()"))
if (overload(1) != 10):
- raise RuntimeError, ("overload(int t)")
+ raise RuntimeError(("overload(int t)"))
if (overload(1, 1) != 20):
- raise RuntimeError, ("overload(int t, const int &)")
+ raise RuntimeError(("overload(int t, const int &)"))
if (overload(1, "hello") != 30):
- raise RuntimeError, ("overload(int t, const char *)")
+ raise RuntimeError(("overload(int t, const char *)"))
k = Klass()
if (overload(k) != 10):
- raise RuntimeError, ("overload(Klass t)")
+ raise RuntimeError(("overload(Klass t)"))
if (overload(k, k) != 20):
- raise RuntimeError, ("overload(Klass t, const Klass &)")
+ raise RuntimeError(("overload(Klass t, const Klass &)"))
if (overload(k, "hello") != 30):
- raise RuntimeError, ("overload(Klass t, const char *)")
+ raise RuntimeError(("overload(Klass t, const char *)"))
if (overload(10.0, "hi") != 40):
- raise RuntimeError, ("overload(double t, const char *)")
+ raise RuntimeError(("overload(double t, const char *)"))
if (overload() != 50):
- raise RuntimeError, ("overload(const char *)")
+ raise RuntimeError(("overload(const char *)"))
# everything put in a namespace
if (nsoverload("hi") != 1000):
- raise RuntimeError, ("nsoverload()")
+ raise RuntimeError(("nsoverload()"))
if (nsoverload(1) != 1010):
- raise RuntimeError, ("nsoverload(int t)")
+ raise RuntimeError(("nsoverload(int t)"))
if (nsoverload(1, 1) != 1020):
- raise RuntimeError, ("nsoverload(int t, const int &)")
+ raise RuntimeError(("nsoverload(int t, const int &)"))
if (nsoverload(1, "hello") != 1030):
- raise RuntimeError, ("nsoverload(int t, const char *)")
+ raise RuntimeError(("nsoverload(int t, const char *)"))
if (nsoverload(k) != 1010):
- raise RuntimeError, ("nsoverload(Klass t)")
+ raise RuntimeError(("nsoverload(Klass t)"))
if (nsoverload(k, k) != 1020):
- raise RuntimeError, ("nsoverload(Klass t, const Klass &)")
+ raise RuntimeError(("nsoverload(Klass t, const Klass &)"))
if (nsoverload(k, "hello") != 1030):
- raise RuntimeError, ("nsoverload(Klass t, const char *)")
+ raise RuntimeError(("nsoverload(Klass t, const char *)"))
if (nsoverload(10.0, "hi") != 1040):
- raise RuntimeError, ("nsoverload(double t, const char *)")
+ raise RuntimeError(("nsoverload(double t, const char *)"))
if (nsoverload() != 1050):
- raise RuntimeError, ("nsoverload(const char *)")
+ raise RuntimeError(("nsoverload(const char *)"))
A_foo(1)
diff --git a/Examples/test-suite/python/pointer_reference_runme.py b/Examples/test-suite/python/pointer_reference_runme.py
index b9b47881d..f12648696 100644
--- a/Examples/test-suite/python/pointer_reference_runme.py
+++ b/Examples/test-suite/python/pointer_reference_runme.py
@@ -2,15 +2,15 @@ import pointer_reference
s = pointer_reference.get()
if s.value != 10:
- raise RuntimeError, "get test failed"
+ raise RuntimeError("get test failed")
ss = pointer_reference.Struct(20)
pointer_reference.set(ss)
if pointer_reference.cvar.Struct_instance.value != 20:
- raise RuntimeError, "set test failed"
+ raise RuntimeError("set test failed")
if pointer_reference.overloading(1) != 111:
- raise RuntimeError, "overload test 1 failed"
+ raise RuntimeError("overload test 1 failed")
if pointer_reference.overloading(ss) != 222:
- raise RuntimeError, "overload test 2 failed"
+ raise RuntimeError("overload test 2 failed")
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):
diff --git a/Examples/test-suite/python/python_builtin_runme.py b/Examples/test-suite/python/python_builtin_runme.py
index 26e757ca7..8a42a2607 100644
--- a/Examples/test-suite/python/python_builtin_runme.py
+++ b/Examples/test-suite/python/python_builtin_runme.py
@@ -32,7 +32,7 @@ if is_python_builtin():
passed = False
try:
h = hash(ExceptionHashFunction())
- except RuntimeError, e:
+ except RuntimeError as e:
passed = str(e).find("oops") != -1
pass
diff --git a/Examples/test-suite/python/python_overload_simple_cast_runme.py b/Examples/test-suite/python/python_overload_simple_cast_runme.py
index d4cb8a37a..fc398ab29 100644
--- a/Examples/test-suite/python/python_overload_simple_cast_runme.py
+++ b/Examples/test-suite/python/python_overload_simple_cast_runme.py
@@ -30,136 +30,136 @@ except:
good = 1
if not good:
- raise RuntimeError, "fint(int)"
+ raise RuntimeError("fint(int)")
if fint(ad) != "fint:int":
- raise RuntimeError, "fint(int)"
+ raise RuntimeError("fint(int)")
if fdouble(ad) != "fdouble:double":
- raise RuntimeError, "fdouble(double)"
+ raise RuntimeError("fdouble(double)")
if fint(ai) != "fint:int":
- raise RuntimeError, "fint(int)"
+ raise RuntimeError("fint(int)")
if fint(5.0) != "fint:int":
- raise RuntimeError, "fint(int)"
+ raise RuntimeError("fint(int)")
if fint(3) != "fint:int":
- raise RuntimeError, "fint(int)"
+ raise RuntimeError("fint(int)")
if fint(3.0) != "fint:int":
- raise RuntimeError, "fint(int)"
+ raise RuntimeError("fint(int)")
if fdouble(ad) != "fdouble:double":
- raise RuntimeError, "fdouble(double)"
+ raise RuntimeError("fdouble(double)")
if fdouble(3) != "fdouble:double":
- raise RuntimeError, "fdouble(double)"
+ raise RuntimeError("fdouble(double)")
if fdouble(3.0) != "fdouble:double":
- raise RuntimeError, "fdouble(double)"
+ raise RuntimeError("fdouble(double)")
if fid(3, 3.0) != "fid:intdouble":
- raise RuntimeError, "fid:intdouble"
+ raise RuntimeError("fid:intdouble")
if fid(3.0, 3) != "fid:doubleint":
- raise RuntimeError, "fid:doubleint"
+ raise RuntimeError("fid:doubleint")
if fid(ad, ai) != "fid:doubleint":
- raise RuntimeError, "fid:doubleint"
+ raise RuntimeError("fid:doubleint")
if fid(ai, ad) != "fid:intdouble":
- raise RuntimeError, "fid:intdouble"
+ raise RuntimeError("fid:intdouble")
if foo(3) != "foo:int":
- raise RuntimeError, "foo(int)"
+ raise RuntimeError("foo(int)")
if foo(3.0) != "foo:double":
- raise RuntimeError, "foo(double)"
+ raise RuntimeError("foo(double)")
if foo("hello") != "foo:char *":
- raise RuntimeError, "foo(char *)"
+ raise RuntimeError("foo(char *)")
f = Foo()
b = Bar()
if foo(f) != "foo:Foo *":
- raise RuntimeError, "foo(Foo *)"
+ raise RuntimeError("foo(Foo *)")
if foo(b) != "foo:Bar *":
- raise RuntimeError, "foo(Bar *)"
+ raise RuntimeError("foo(Bar *)")
v = malloc_void(32)
if foo(v) != "foo:void *":
- raise RuntimeError, "foo(void *)"
+ raise RuntimeError("foo(void *)")
s = Spam()
if s.foo(3) != "foo:int":
- raise RuntimeError, "Spam::foo(int)"
+ raise RuntimeError("Spam::foo(int)")
if s.foo(3.0) != "foo:double":
- raise RuntimeError, "Spam::foo(double)"
+ raise RuntimeError("Spam::foo(double)")
if s.foo("hello") != "foo:char *":
- raise RuntimeError, "Spam::foo(char *)"
+ raise RuntimeError("Spam::foo(char *)")
if s.foo(f) != "foo:Foo *":
- raise RuntimeError, "Spam::foo(Foo *)"
+ raise RuntimeError("Spam::foo(Foo *)")
if s.foo(b) != "foo:Bar *":
- raise RuntimeError, "Spam::foo(Bar *)"
+ raise RuntimeError("Spam::foo(Bar *)")
if s.foo(v) != "foo:void *":
- raise RuntimeError, "Spam::foo(void *)"
+ raise RuntimeError("Spam::foo(void *)")
if Spam_bar(3) != "bar:int":
- raise RuntimeError, "Spam::bar(int)"
+ raise RuntimeError("Spam::bar(int)")
if Spam_bar(3.0) != "bar:double":
- raise RuntimeError, "Spam::bar(double)"
+ raise RuntimeError("Spam::bar(double)")
if Spam_bar("hello") != "bar:char *":
- raise RuntimeError, "Spam::bar(char *)"
+ raise RuntimeError("Spam::bar(char *)")
if Spam_bar(f) != "bar:Foo *":
- raise RuntimeError, "Spam::bar(Foo *)"
+ raise RuntimeError("Spam::bar(Foo *)")
if Spam_bar(b) != "bar:Bar *":
- raise RuntimeError, "Spam::bar(Bar *)"
+ raise RuntimeError("Spam::bar(Bar *)")
if Spam_bar(v) != "bar:void *":
- raise RuntimeError, "Spam::bar(void *)"
+ raise RuntimeError("Spam::bar(void *)")
# Test constructors
s = Spam()
if s.type != "none":
- raise RuntimeError, "Spam()"
+ raise RuntimeError("Spam()")
s = Spam(3)
if s.type != "int":
- raise RuntimeError, "Spam(int)"
+ raise RuntimeError("Spam(int)")
s = Spam(3.4)
if s.type != "double":
- raise RuntimeError, "Spam(double)"
+ raise RuntimeError("Spam(double)")
s = Spam("hello")
if s.type != "char *":
- raise RuntimeError, "Spam(char *)"
+ raise RuntimeError("Spam(char *)")
s = Spam(f)
if s.type != "Foo *":
- raise RuntimeError, "Spam(Foo *)"
+ raise RuntimeError("Spam(Foo *)")
s = Spam(b)
if s.type != "Bar *":
- raise RuntimeError, "Spam(Bar *)"
+ raise RuntimeError("Spam(Bar *)")
s = Spam(v)
if s.type != "void *":
- raise RuntimeError, "Spam(void *)"
+ raise RuntimeError("Spam(void *)")
# unsigned long long
@@ -168,13 +168,13 @@ ullmaxd = 9007199254740992.0
ullmin = 0
ullmind = 0.0
if ull(ullmin) != ullmin:
- raise RuntimeError, "ull(ullmin)"
+ raise RuntimeError("ull(ullmin)")
if ull(ullmax) != ullmax:
- raise RuntimeError, "ull(ullmax)"
+ raise RuntimeError("ull(ullmax)")
if ull(ullmind) != ullmind:
- raise RuntimeError, "ull(ullmind)"
+ raise RuntimeError("ull(ullmind)")
if ull(ullmaxd) != ullmaxd:
- raise RuntimeError, "ull(ullmaxd)"
+ raise RuntimeError("ull(ullmaxd)")
# long long
llmax = 9223372036854775807 # 0x7fffffffffffffff
@@ -183,13 +183,13 @@ llmin = -9223372036854775808
llmaxd = 9007199254740992.0
llmind = -9007199254740992.0
if ll(llmin) != llmin:
- raise RuntimeError, "ll(llmin)"
+ raise RuntimeError("ll(llmin)")
if ll(llmax) != llmax:
- raise RuntimeError, "ll(llmax)"
+ raise RuntimeError("ll(llmax)")
if ll(llmind) != llmind:
- raise RuntimeError, "ll(llmind)"
+ raise RuntimeError("ll(llmind)")
if ll(llmaxd) != llmaxd:
- raise RuntimeError, "ll(llmaxd)"
+ raise RuntimeError("ll(llmaxd)")
free_void(v)
diff --git a/Examples/test-suite/python/python_richcompare_runme.py b/Examples/test-suite/python/python_richcompare_runme.py
index 724d1d73c..988a3f91f 100644
--- a/Examples/test-suite/python/python_richcompare_runme.py
+++ b/Examples/test-suite/python/python_richcompare_runme.py
@@ -114,22 +114,22 @@ else:
try:
res = base1 < 42
raise RuntimeError("Failed to throw")
- except TypeError,e:
+ except TypeError as e:
check_unorderable_types(e)
try:
res = base1 <= 42
raise RuntimeError("Failed to throw")
- except TypeError,e:
+ except TypeError as e:
check_unorderable_types(e)
try:
res = base1 > 42
raise RuntimeError("Failed to throw")
- except TypeError,e:
+ except TypeError as e:
check_unorderable_types(e)
try:
res = base1 >= 42
raise RuntimeError("Failed to throw")
- except TypeError,e:
+ except TypeError as e:
check_unorderable_types(e)
# Check inequalities used for ordering
diff --git a/Examples/test-suite/python/std_containers_runme.py b/Examples/test-suite/python/std_containers_runme.py
index 51bd2a7b8..820c8f454 100644
--- a/Examples/test-suite/python/std_containers_runme.py
+++ b/Examples/test-suite/python/std_containers_runme.py
@@ -7,29 +7,29 @@ cube = (((1, 2), (3, 4)), ((5, 6), (7, 8)))
icube = std_containers.cident(cube)
for i in range(0, len(cube)):
if cube[i] != icube[i]:
- raise RuntimeError, "bad cident"
+ raise RuntimeError("bad cident")
p = (1, 2)
if p != std_containers.pident(p):
- raise RuntimeError, "bad pident"
+ raise RuntimeError("bad pident")
v = (1, 2, 3, 4, 5, 6)
iv = std_containers.vident(v)
for i in range(0, len(v)):
if v[i] != iv[i]:
- raise RuntimeError, "bad vident"
+ raise RuntimeError("bad vident")
iv = std_containers.videntu(v)
for i in range(0, len(v)):
if v[i] != iv[i]:
- raise RuntimeError, "bad videntu"
+ raise RuntimeError("bad videntu")
vu = std_containers.vector_ui(v)
if vu[2] != std_containers.videntu(vu)[2]:
- raise RuntimeError, "bad videntu"
+ raise RuntimeError("bad videntu")
if v[0:3][1] != vu[0:3][1]:
@@ -42,20 +42,20 @@ im = std_containers.midenti(m)
for i in range(0, len(m)):
for j in range(0, len(m[i])):
if m[i][j] != im[i][j]:
- raise RuntimeError, "bad getslice"
+ raise RuntimeError("bad getslice")
m = ((True, False, True), (True, True), (True, True))
im = std_containers.midentb(m)
for i in range(0, len(m)):
for j in range(0, len(m[i])):
if m[i][j] != im[i][j]:
- raise RuntimeError, "bad getslice"
+ raise RuntimeError("bad getslice")
mi = std_containers.imatrix(m)
mc = std_containers.cmatrix(m)
if mi[0][1] != mc[0][1]:
- raise RuntimeError, "bad matrix"
+ raise RuntimeError("bad matrix")
map = {}
@@ -66,7 +66,7 @@ map["3"] = 2
imap = std_containers.mapident(map)
for k in map:
if map[k] != imap[k]:
- raise RuntimeError, "bad map"
+ raise RuntimeError("bad map")
# Test __contains__ (required for 'x in y' to work)
if not imap.__contains__("hello"):
diff --git a/Examples/test-suite/python/struct_value_runme.py b/Examples/test-suite/python/struct_value_runme.py
index aa3ece38c..9fe5c815c 100644
--- a/Examples/test-suite/python/struct_value_runme.py
+++ b/Examples/test-suite/python/struct_value_runme.py
@@ -17,7 +17,7 @@ b.added = 123
if b.added != 123:
raise RuntimeError("Wrong attribute value")
-if not b.__dict__.has_key("added"):
+if "added" not in b.__dict__:
raise RuntimeError("Missing added attribute in __dict__")
@@ -28,7 +28,7 @@ class PyBar(struct_value.Bar):
struct_value.Bar.__init__(self)
pybar = PyBar()
-if not pybar.__dict__.has_key("extra"):
+if "extra" not in pybar.__dict__:
raise RuntimeError("Missing extra attribute in __dict__")
if pybar.extra != "hi":
raise RuntimeError("Incorrect attribute value for extra")
diff --git a/Examples/test-suite/python/template_classes_runme.py b/Examples/test-suite/python/template_classes_runme.py
index 38b2d7a62..1bd133975 100644
--- a/Examples/test-suite/python/template_classes_runme.py
+++ b/Examples/test-suite/python/template_classes_runme.py
@@ -13,7 +13,7 @@ RectangleInt.static_onearg(1)
fail = True
try:
rectangle.setPoint()
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
@@ -22,7 +22,7 @@ if fail:
fail = True
try:
rectangle.getPoint(0)
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
@@ -30,7 +30,7 @@ if fail:
fail = True
try:
RectangleInt.static_noargs(0)
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
@@ -38,7 +38,7 @@ if fail:
fail = True
try:
RectangleInt.static_onearg()
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
diff --git a/Examples/test-suite/python/template_default_arg_runme.py b/Examples/test-suite/python/template_default_arg_runme.py
index 91b1e0e8c..e9ef00f99 100644
--- a/Examples/test-suite/python/template_default_arg_runme.py
+++ b/Examples/test-suite/python/template_default_arg_runme.py
@@ -7,25 +7,25 @@ helloInt.foo(template_default_arg.Hello_int.hi)
x = template_default_arg.X_int()
if (x.meth(20.0, 200) != 200):
- raise RuntimeError, ("X_int test 1 failed")
+ raise RuntimeError(("X_int test 1 failed"))
if (x.meth(20) != 20):
- raise RuntimeError, ("X_int test 2 failed")
+ raise RuntimeError(("X_int test 2 failed"))
if (x.meth() != 0):
- raise RuntimeError, ("X_int test 3 failed")
+ raise RuntimeError(("X_int test 3 failed"))
y = template_default_arg.Y_unsigned()
if (y.meth(20.0, 200) != 200):
- raise RuntimeError, ("Y_unsigned test 1 failed")
+ raise RuntimeError(("Y_unsigned test 1 failed"))
if (y.meth(20) != 20):
- raise RuntimeError, ("Y_unsigned test 2 failed")
+ raise RuntimeError(("Y_unsigned test 2 failed"))
if (y.meth() != 0):
- raise RuntimeError, ("Y_unsigned test 3 failed")
+ raise RuntimeError(("Y_unsigned test 3 failed"))
x = template_default_arg.X_longlong()
x = template_default_arg.X_longlong(20.0)
-x = template_default_arg.X_longlong(20.0, 200L)
+x = template_default_arg.X_longlong(20.0, 200)
x = template_default_arg.X_int()
@@ -54,40 +54,40 @@ fzc = x.meth(fz)
# plain function: int ott(Foo<int>)
if (template_default_arg.ott(template_default_arg.Foo_int()) != 30):
- raise RuntimeError, ("ott test 1 failed")
+ raise RuntimeError(("ott test 1 failed"))
# %template(ott) ott<int, int>
if (template_default_arg.ott() != 10):
- raise RuntimeError, ("ott test 2 failed")
+ raise RuntimeError(("ott test 2 failed"))
if (template_default_arg.ott(1) != 10):
- raise RuntimeError, ("ott test 3 failed")
+ raise RuntimeError(("ott test 3 failed"))
if (template_default_arg.ott(1, 1) != 10):
- raise RuntimeError, ("ott test 4 failed")
+ raise RuntimeError(("ott test 4 failed"))
if (template_default_arg.ott("hi") != 20):
- raise RuntimeError, ("ott test 5 failed")
+ raise RuntimeError(("ott test 5 failed"))
if (template_default_arg.ott("hi", 1) != 20):
- raise RuntimeError, ("ott test 6 failed")
+ raise RuntimeError(("ott test 6 failed"))
if (template_default_arg.ott("hi", 1, 1) != 20):
- raise RuntimeError, ("ott test 7 failed")
+ raise RuntimeError(("ott test 7 failed"))
# %template(ott) ott<const char *>
if (template_default_arg.ottstring(template_default_arg.Hello_int(), "hi") != 40):
- raise RuntimeError, ("ott test 8 failed")
+ raise RuntimeError(("ott test 8 failed"))
if (template_default_arg.ottstring(template_default_arg.Hello_int()) != 40):
- raise RuntimeError, ("ott test 9 failed")
+ raise RuntimeError(("ott test 9 failed"))
# %template(ott) ott<int>
if (template_default_arg.ottint(template_default_arg.Hello_int(), 1) != 50):
- raise RuntimeError, ("ott test 10 failed")
+ raise RuntimeError(("ott test 10 failed"))
if (template_default_arg.ottint(template_default_arg.Hello_int()) != 50):
- raise RuntimeError, ("ott test 11 failed")
+ raise RuntimeError(("ott test 11 failed"))
# %template(ott) ott<double>
if (template_default_arg.ott(template_default_arg.Hello_int(), 1.0) != 60):
- raise RuntimeError, ("ott test 12 failed")
+ raise RuntimeError(("ott test 12 failed"))
if (template_default_arg.ott(template_default_arg.Hello_int()) != 60):
- raise RuntimeError, ("ott test 13 failed")
+ raise RuntimeError(("ott test 13 failed"))
diff --git a/Examples/test-suite/python/template_typemaps_typedef2_runme.py b/Examples/test-suite/python/template_typemaps_typedef2_runme.py
index 2b8bd5631..da26a9f76 100644
--- a/Examples/test-suite/python/template_typemaps_typedef2_runme.py
+++ b/Examples/test-suite/python/template_typemaps_typedef2_runme.py
@@ -5,7 +5,7 @@ m1 = MultimapIntA()
dummy_pair = m1.make_dummy_pair()
val = m1.typemap_test(dummy_pair).val
if val != 1234:
- raise RuntimeError, "typemaps not working"
+ raise RuntimeError("typemaps not working")
m2 = MultimapAInt()
@@ -18,19 +18,19 @@ m2 = MultimapAInt()
# raise RuntimeError, "typemaps not working"
if typedef_test1(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test1 not working"
+ raise RuntimeError("typedef_test1 not working")
if typedef_test2(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test2 not working"
+ raise RuntimeError("typedef_test2 not working")
if typedef_test3(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test3 not working"
+ raise RuntimeError("typedef_test3 not working")
if typedef_test4(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test4 not working"
+ raise RuntimeError("typedef_test4 not working")
if typedef_test5(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test5 not working"
+ raise RuntimeError("typedef_test5 not working")
if typedef_test6(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test6 not working"
+ raise RuntimeError("typedef_test6 not working")
diff --git a/Examples/test-suite/python/template_typemaps_typedef_runme.py b/Examples/test-suite/python/template_typemaps_typedef_runme.py
index d84be64ff..a5209b71f 100644
--- a/Examples/test-suite/python/template_typemaps_typedef_runme.py
+++ b/Examples/test-suite/python/template_typemaps_typedef_runme.py
@@ -5,7 +5,7 @@ m1 = MultimapIntA()
dummy_pair = m1.make_dummy_pair()
val = m1.typemap_test(dummy_pair).val
if val != 1234:
- raise RuntimeError, "typemaps not working"
+ raise RuntimeError("typemaps not working")
m2 = MultimapAInt()
@@ -18,19 +18,19 @@ m2 = MultimapAInt()
# raise RuntimeError, "typemaps not working"
if typedef_test1(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test1 not working"
+ raise RuntimeError("typedef_test1 not working")
if typedef_test2(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test2 not working"
+ raise RuntimeError("typedef_test2 not working")
if typedef_test3(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test3 not working"
+ raise RuntimeError("typedef_test3 not working")
if typedef_test4(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test4 not working"
+ raise RuntimeError("typedef_test4 not working")
if typedef_test5(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test5 not working"
+ raise RuntimeError("typedef_test5 not working")
if typedef_test6(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test6 not working"
+ raise RuntimeError("typedef_test6 not working")
diff --git a/Examples/test-suite/python/threads_exception_runme.py b/Examples/test-suite/python/threads_exception_runme.py
index 056bd849b..e3f6299e7 100644
--- a/Examples/test-suite/python/threads_exception_runme.py
+++ b/Examples/test-suite/python/threads_exception_runme.py
@@ -3,18 +3,18 @@ import threads_exception
t = threads_exception.Test()
try:
t.unknown()
-except RuntimeError, e:
+except RuntimeError as e:
pass
try:
t.simple()
-except RuntimeError, e:
+except RuntimeError as e:
if e.args[0] != 37:
raise RuntimeError
try:
t.message()
-except RuntimeError, e:
+except RuntimeError as e:
if e.args[0] != "I died.":
raise RuntimeError
@@ -23,18 +23,18 @@ except RuntimeError, e:
if not threads_exception.is_python_builtin():
try:
t.hosed()
- except threads_exception.Exc, e:
+ except threads_exception.Exc as e:
code = e.code
if code != 42:
- raise RuntimeError, "bad... code: %d" % code
+ raise RuntimeError("bad... code: %d" % code)
msg = e.msg
if msg != "Hosed":
- raise RuntimeError, "bad... msg: '%s' len: %d" % (msg, len(msg))
+ raise RuntimeError("bad... msg: '%s' len: %d" % (msg, len(msg)))
for i in range(1, 4):
try:
t.multi(i)
- except RuntimeError, e:
+ except RuntimeError as e:
pass
- except threads_exception.Exc, e:
+ except threads_exception.Exc as e:
pass
diff --git a/Examples/test-suite/python/typemap_arrays_runme.py b/Examples/test-suite/python/typemap_arrays_runme.py
index ea0f08d6b..7bc45f908 100644
--- a/Examples/test-suite/python/typemap_arrays_runme.py
+++ b/Examples/test-suite/python/typemap_arrays_runme.py
@@ -1,4 +1,4 @@
from typemap_arrays import *
if sumA(None) != 60:
- raise RuntimeError, "Sum is wrong"
+ raise RuntimeError("Sum is wrong")
diff --git a/Examples/test-suite/python/typename_runme.py b/Examples/test-suite/python/typename_runme.py
index aac936fde..a4f76fc36 100644
--- a/Examples/test-suite/python/typename_runme.py
+++ b/Examples/test-suite/python/typename_runme.py
@@ -4,8 +4,8 @@ f = typename.Foo()
b = typename.Bar()
x = typename.twoFoo(f)
-if not isinstance(x, types.FloatType):
- raise RuntimeError, "Wrong return type (FloatType) !"
+if not isinstance(x, float):
+ raise RuntimeError("Wrong return type (FloatType) !")
y = typename.twoBar(b)
-if not isinstance(y, types.IntType):
- raise RuntimeError, "Wrong return type (IntType)!"
+if not isinstance(y, int):
+ raise RuntimeError("Wrong return type (IntType)!")
diff --git a/Examples/test-suite/python/using_composition_runme.py b/Examples/test-suite/python/using_composition_runme.py
index c4f339095..67f72bc2f 100644
--- a/Examples/test-suite/python/using_composition_runme.py
+++ b/Examples/test-suite/python/using_composition_runme.py
@@ -2,32 +2,32 @@ from using_composition import *
f = FooBar()
if f.blah(3) != 3:
- raise RuntimeError, "FooBar::blah(int)"
+ raise RuntimeError("FooBar::blah(int)")
if f.blah(3.5) != 3.5:
- raise RuntimeError, "FooBar::blah(double)"
+ raise RuntimeError("FooBar::blah(double)")
if f.blah("hello") != "hello":
- raise RuntimeError, "FooBar::blah(char *)"
+ raise RuntimeError("FooBar::blah(char *)")
f = FooBar2()
if f.blah(3) != 3:
- raise RuntimeError, "FooBar2::blah(int)"
+ raise RuntimeError("FooBar2::blah(int)")
if f.blah(3.5) != 3.5:
- raise RuntimeError, "FooBar2::blah(double)"
+ raise RuntimeError("FooBar2::blah(double)")
if f.blah("hello") != "hello":
- raise RuntimeError, "FooBar2::blah(char *)"
+ raise RuntimeError("FooBar2::blah(char *)")
f = FooBar3()
if f.blah(3) != 3:
- raise RuntimeError, "FooBar3::blah(int)"
+ raise RuntimeError("FooBar3::blah(int)")
if f.blah(3.5) != 3.5:
- raise RuntimeError, "FooBar3::blah(double)"
+ raise RuntimeError("FooBar3::blah(double)")
if f.blah("hello") != "hello":
- raise RuntimeError, "FooBar3::blah(char *)"
+ raise RuntimeError("FooBar3::blah(char *)")
diff --git a/Examples/test-suite/python/using_extend_runme.py b/Examples/test-suite/python/using_extend_runme.py
index 038a1686a..7e0912926 100644
--- a/Examples/test-suite/python/using_extend_runme.py
+++ b/Examples/test-suite/python/using_extend_runme.py
@@ -2,20 +2,20 @@ from using_extend import *
f = FooBar()
if f.blah(3) != 3:
- raise RuntimeError, "blah(int)"
+ raise RuntimeError("blah(int)")
if f.blah(3.5) != 3.5:
- raise RuntimeError, "blah(double)"
+ raise RuntimeError("blah(double)")
if f.blah("hello") != "hello":
- raise RuntimeError, "blah(char *)"
+ raise RuntimeError("blah(char *)")
if f.blah(3, 4) != 7:
- raise RuntimeError, "blah(int,int)"
+ raise RuntimeError("blah(int,int)")
if f.blah(3.5, 7.5) != (3.5 + 7.5):
- raise RuntimeError, "blah(double,double)"
+ raise RuntimeError("blah(double,double)")
if f.duh(3) != 3:
- raise RuntimeError, "duh(int)"
+ raise RuntimeError("duh(int)")
diff --git a/Examples/test-suite/python/using_inherit_runme.py b/Examples/test-suite/python/using_inherit_runme.py
index 4fd595968..ccdeece8d 100644
--- a/Examples/test-suite/python/using_inherit_runme.py
+++ b/Examples/test-suite/python/using_inherit_runme.py
@@ -2,47 +2,47 @@ from using_inherit import *
b = Bar()
if b.test(3) != 3:
- raise RuntimeError, "Bar::test(int)"
+ raise RuntimeError("Bar::test(int)")
if b.test(3.5) != 3.5:
- raise RuntimeError, "Bar::test(double)"
+ raise RuntimeError("Bar::test(double)")
b = Bar2()
if b.test(3) != 6:
- raise RuntimeError, "Bar2::test(int)"
+ raise RuntimeError("Bar2::test(int)")
if b.test(3.5) != 7.0:
- raise RuntimeError, "Bar2::test(double)"
+ raise RuntimeError("Bar2::test(double)")
b = Bar3()
if b.test(3) != 6:
- raise RuntimeError, "Bar3::test(int)"
+ raise RuntimeError("Bar3::test(int)")
if b.test(3.5) != 7.0:
- raise RuntimeError, "Bar3::test(double)"
+ raise RuntimeError("Bar3::test(double)")
b = Bar4()
if b.test(3) != 6:
- raise RuntimeError, "Bar4::test(int)"
+ raise RuntimeError("Bar4::test(int)")
if b.test(3.5) != 7.0:
- raise RuntimeError, "Bar4::test(double)"
+ raise RuntimeError("Bar4::test(double)")
b = Fred1()
if b.test(3) != 3:
- raise RuntimeError, "Fred1::test(int)"
+ raise RuntimeError("Fred1::test(int)")
if b.test(3.5) != 7.0:
- raise RuntimeError, "Fred1::test(double)"
+ raise RuntimeError("Fred1::test(double)")
b = Fred2()
if b.test(3) != 3:
- raise RuntimeError, "Fred2::test(int)"
+ raise RuntimeError("Fred2::test(int)")
if b.test(3.5) != 7.0:
- raise RuntimeError, "Fred2::test(double)"
+ raise RuntimeError("Fred2::test(double)")
diff --git a/Examples/test-suite/python/using_private_runme.py b/Examples/test-suite/python/using_private_runme.py
index 00c9a8d25..9e0a15f12 100644
--- a/Examples/test-suite/python/using_private_runme.py
+++ b/Examples/test-suite/python/using_private_runme.py
@@ -4,10 +4,10 @@ f = FooBar()
f.x = 3
if f.blah(4) != 4:
- raise RuntimeError, "blah(int)"
+ raise RuntimeError("blah(int)")
if f.defaulted() != -1:
- raise RuntimeError, "defaulted()"
+ raise RuntimeError("defaulted()")
if f.defaulted(222) != 222:
- raise RuntimeError, "defaulted(222)"
+ raise RuntimeError("defaulted(222)")
diff --git a/Examples/test-suite/python/using_protected_runme.py b/Examples/test-suite/python/using_protected_runme.py
index 525a1cde4..dd477237e 100644
--- a/Examples/test-suite/python/using_protected_runme.py
+++ b/Examples/test-suite/python/using_protected_runme.py
@@ -4,4 +4,4 @@ f = FooBar()
f.x = 3
if f.blah(4) != 4:
- raise RuntimeError, "blah(int)"
+ raise RuntimeError("blah(int)")
diff --git a/Examples/test-suite/python/varargs_overload_runme.py b/Examples/test-suite/python/varargs_overload_runme.py
index 6f5a70222..ffa763450 100644
--- a/Examples/test-suite/python/varargs_overload_runme.py
+++ b/Examples/test-suite/python/varargs_overload_runme.py
@@ -1,62 +1,62 @@
import varargs_overload
if varargs_overload.vararg_over1("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over1(2) != "2":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over2("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over2(2, 2.2) != "2 2.2":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over3("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over3(2, 2.2, "hey") != "2 2.2 hey":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over4("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over4(123) != "123":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over4("Hello", 123) != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
# Same as above but non-vararg function declared first
if varargs_overload.vararg_over6("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over6(2) != "2":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over7("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over7(2, 2.2) != "2 2.2":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over8("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over8(2, 2.2, "hey") != "2 2.2 hey":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over9("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over9(123) != "123":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over9("Hello", 123) != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
diff --git a/Examples/test-suite/python/varargs_runme.py b/Examples/test-suite/python/varargs_runme.py
index 277ea757a..8f90d5cde 100644
--- a/Examples/test-suite/python/varargs_runme.py
+++ b/Examples/test-suite/python/varargs_runme.py
@@ -1,31 +1,31 @@
import varargs
if varargs.test("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
f = varargs.Foo("Greetings")
if f.str != "Greetings":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if f.test("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs.test_def("Hello", 1) != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs.test_def("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
###
if varargs.test_plenty("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs.test_plenty("Hello", 1) != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs.test_plenty("Hello", 1, 2) != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
try:
varargs.test_plenty("Hello", 1, 2, 3)
diff --git a/Examples/test-suite/python/virtual_derivation_runme.py b/Examples/test-suite/python/virtual_derivation_runme.py
index 68546c6eb..21014bd02 100644
--- a/Examples/test-suite/python/virtual_derivation_runme.py
+++ b/Examples/test-suite/python/virtual_derivation_runme.py
@@ -4,4 +4,4 @@ from virtual_derivation import *
#
b = B(3)
if b.get_a() != b.get_b():
- raise RuntimeError, "something is really wrong"
+ raise RuntimeError("something is really wrong")