From efb8784c8b9240bac0868f2de3ac70289aea9b0d Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 8 Jan 2015 23:54:50 +0000 Subject: Fix python default_args testcase for Python 3 Changes for the default_args testcase to run under Python 3 when called from python_default_args testcase --- Examples/test-suite/python/default_args_runme.py | 21 ++++++++++----------- Examples/test-suite/python_default_args.i | 1 + 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'Examples') diff --git a/Examples/test-suite/python/default_args_runme.py b/Examples/test-suite/python/default_args_runme.py index 45465bac9..f24e825ad 100644 --- a/Examples/test-suite/python/default_args_runme.py +++ b/Examples/test-suite/python/default_args_runme.py @@ -2,10 +2,9 @@ def run(module_name): default_args = __import__(module_name) - print "running...." ec = default_args.EnumClass() if not ec.blah(): - raise RuntimeError,"EnumClass::blah() default arguments don't work" + raise RuntimeError("EnumClass::blah() default arguments don't work") de = default_args.DerivedEnumClass() de.accelerate() @@ -35,51 +34,51 @@ def run(module_name): error = 1 except: error = 0 - if error: raise RuntimeError,"Foo::Foo ignore is not working" + if error: raise RuntimeError("Foo::Foo ignore is not working") try: f = default_args.Foo(1,2) error = 1 except: error = 0 - if error: raise RuntimeError,"Foo::Foo ignore is not working" + if error: raise RuntimeError("Foo::Foo ignore is not working") try: f = default_args.Foo(1,2,3) error = 1 except: error = 0 - if error: raise RuntimeError,"Foo::Foo ignore is not working" + if error: raise RuntimeError("Foo::Foo ignore is not working") try: m = f.meth(1) error = 1 except: error = 0 - if error: raise RuntimeError,"Foo::meth ignore is not working" + if error: raise RuntimeError("Foo::meth ignore is not working") try: m = f.meth(1,2) error = 1 except: error = 0 - if error: raise RuntimeError,"Foo::meth ignore is not working" + if error: raise RuntimeError("Foo::meth ignore is not working") try: m = f.meth(1,2,3) error = 1 except: error = 0 - if error: raise RuntimeError,"Foo::meth ignore is not working" + if error: raise RuntimeError("Foo::meth ignore is not working") if default_args.Klass.inc(100, default_args.Klass(22)).val != 122: - raise RuntimeError, "Klass::inc failed" + raise RuntimeError("Klass::inc failed") if default_args.Klass.inc(100).val != 99: - raise RuntimeError, "Klass::inc failed" + raise RuntimeError("Klass::inc failed") if default_args.Klass.inc().val != 0: - raise RuntimeError, "Klass::inc failed" + raise RuntimeError("Klass::inc failed") default_args.trickyvalue1(10); default_args.trickyvalue1(10, 10) default_args.trickyvalue2(10); default_args.trickyvalue2(10, 10) diff --git a/Examples/test-suite/python_default_args.i b/Examples/test-suite/python_default_args.i index 66e66a671..01c090342 100644 --- a/Examples/test-suite/python_default_args.i +++ b/Examples/test-suite/python_default_args.i @@ -3,6 +3,7 @@ %pythondefaultargs; // Turn off the feature for the tricky cases that can't be handled +%nopythondefaultargs trickyvalue3; // 'mode=0644' is okay in Python 2, but no Python 3 %nopythondefaultargs seek; %nopythondefaultargs Space::Klass::inc; %nopythondefaultargs DerivedEnumClass::accelerate; -- cgit v1.2.1