summaryrefslogtreecommitdiff
path: root/Examples
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2015-01-08 23:54:50 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2015-01-09 00:37:23 +0000
commitefb8784c8b9240bac0868f2de3ac70289aea9b0d (patch)
treea805176928cd82f087a4635d1868dc1b28dc5a39 /Examples
parent38ba81811e4fd7743570cf3ca6b9a57a720444a1 (diff)
downloadswig-efb8784c8b9240bac0868f2de3ac70289aea9b0d.tar.gz
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
Diffstat (limited to 'Examples')
-rw-r--r--Examples/test-suite/python/default_args_runme.py21
-rw-r--r--Examples/test-suite/python_default_args.i1
2 files changed, 11 insertions, 11 deletions
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;