diff --git a/Examples/test-suite/python/cpp11_template_explicit_runme.py b/Examples/test-suite/python/cpp11_template_explicit_runme.py index e713ad0d9..dacfb74c8 100644 --- a/Examples/test-suite/python/cpp11_template_explicit_runme.py +++ b/Examples/test-suite/python/cpp11_template_explicit_runme.py @@ -1,11 +1,15 @@ import cpp11_template_explicit +def swig_assert_isinstance(a, b): + if not isinstance(a, b): + raise RuntimeError(str(a) + " not an instance of " + str(b)) + # Call variants of the same templated function t1 = cpp11_template_explicit.my_templated_function_int (1,1.0) t2 = cpp11_template_explicit.my_templated_function_A (2,2.0) t3 = cpp11_template_explicit.my_templated_function_TemperInt(3,3.0) # Check return types -assert isinstance(t1,int) -assert isinstance(t2,cpp11_template_explicit.A) -assert isinstance(t3,cpp11_template_explicit.TemperInt) +swig_assert_isinstance(t1,int) +swig_assert_isinstance(t2,cpp11_template_explicit.A) +swig_assert_isinstance(t3,cpp11_template_explicit.TemperInt) diff --git a/Examples/test-suite/python/li_boost_shared_ptr_director_runme.py b/Examples/test-suite/python/li_boost_shared_ptr_director_runme.py index 52868eacc..b4382ca1e 100644 --- a/Examples/test-suite/python/li_boost_shared_ptr_director_runme.py +++ b/Examples/test-suite/python/li_boost_shared_ptr_director_runme.py @@ -1,5 +1,9 @@ from li_boost_shared_ptr_director import * +def swig_assert_equal(a, b): + if a != b: + raise RuntimeError(str(a) + " != " + str(b)) + class Derived(Base): def __init__(self, flag): self.return_none = flag @@ -59,22 +63,22 @@ class Derived(Base): a = Derived(False) b = Derived(True) -assert call_ret_c_shared_ptr(a) == 1 -assert call_ret_c_shared_ptr(b) == -1 -assert call_ret_c_by_value(a) == 1 +swig_assert_equal(call_ret_c_shared_ptr(a), 1) +swig_assert_equal(call_ret_c_shared_ptr(b), -1) +swig_assert_equal(call_ret_c_by_value(a), 1) -assert call_take_c_by_value(a) == 5 -assert call_take_c_by_ref(a) == 6 -assert call_take_c_by_pointer(a) == 7 -assert call_take_c_by_pointer_ref(a) == 8 -assert call_take_c_shared_ptr_by_value(a) == 9 -assert call_take_c_shared_ptr_by_ref(a) == 10 -assert call_take_c_shared_ptr_by_pointer(a) == 11 -assert call_take_c_shared_ptr_by_pointer_ref(a) == 12 +swig_assert_equal(call_take_c_by_value(a), 5) +swig_assert_equal(call_take_c_by_ref(a), 6) +swig_assert_equal(call_take_c_by_pointer(a), 7) +swig_assert_equal(call_take_c_by_pointer_ref(a), 8) +swig_assert_equal(call_take_c_shared_ptr_by_value(a), 9) +swig_assert_equal(call_take_c_shared_ptr_by_ref(a), 10) +swig_assert_equal(call_take_c_shared_ptr_by_pointer(a), 11) +swig_assert_equal(call_take_c_shared_ptr_by_pointer_ref(a), 12) -assert call_take_c_by_pointer_with_null(a) == -2 -assert call_take_c_by_pointer_ref_with_null(a) == -3 -assert call_take_c_shared_ptr_by_value_with_null(a) == -4 -assert call_take_c_shared_ptr_by_ref_with_null(a) == -5 -assert call_take_c_shared_ptr_by_pointer_with_null(a) == -6 -assert call_take_c_shared_ptr_by_pointer_ref_with_null(a) == -7 +swig_assert_equal(call_take_c_by_pointer_with_null(a), -2) +swig_assert_equal(call_take_c_by_pointer_ref_with_null(a), -3) +swig_assert_equal(call_take_c_shared_ptr_by_value_with_null(a), -4) +swig_assert_equal(call_take_c_shared_ptr_by_ref_with_null(a), -5) +swig_assert_equal(call_take_c_shared_ptr_by_pointer_with_null(a), -6) +swig_assert_equal(call_take_c_shared_ptr_by_pointer_ref_with_null(a), -7) diff --git a/Examples/test-suite/python/using_member_runme.py b/Examples/test-suite/python/using_member_runme.py index a666059e2..eda5b5043 100644 --- a/Examples/test-suite/python/using_member_runme.py +++ b/Examples/test-suite/python/using_member_runme.py @@ -1,10 +1,14 @@ from using_member import * +def swig_assert_equal(a, b): + if a != b: + raise RuntimeError(str(a) + " != " + str(b)) + b = B() -assert b.get(int(1)) == 10 -assert b.get(float(1)) == 20 +swig_assert_equal(b.get(int(1)), 10) +swig_assert_equal(b.get(float(1)), 20) bb = BB() -assert bb.greater(int(1)) == 0 -assert bb.greater(float(1)) == 1 -assert bb.great(True) == 2 +swig_assert_equal(bb.greater(int(1)), 0) +swig_assert_equal(bb.greater(float(1)), 1) +swig_assert_equal(bb.great(True), 2)