aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/python/python_nondynamic_runme.py
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/python/python_nondynamic_runme.py')
-rw-r--r--Examples/test-suite/python/python_nondynamic_runme.py18
1 files changed, 5 insertions, 13 deletions
diff --git a/Examples/test-suite/python/python_nondynamic_runme.py b/Examples/test-suite/python/python_nondynamic_runme.py
index fbb60ad36..870c70b3b 100644
--- a/Examples/test-suite/python/python_nondynamic_runme.py
+++ b/Examples/test-suite/python/python_nondynamic_runme.py
@@ -1,9 +1,5 @@
import python_nondynamic
-def is_python_modern():
- """Return True if SWIG is generating Python code using -modern. Works only if %python_nondynamic has been used."""
- return hasattr(python_nondynamic, "_swig_setattr_nondynamic_class_variable")
-
def debug_print(s):
show_debug = False
if show_debug:
@@ -51,9 +47,7 @@ if python_nondynamic.retrieve_A_b(bb) != 5: raise RuntimeError("b not set correc
try:
bb.c = 3
- print("bb.c = {}".format(bb.c))
- print("B.c = {}".format(B.c))
- raise RuntimeError("B.c class variable messes up nondynamic-ness of B")
+ raise RuntimeError("B.c class variable messes up nondynamic-ness of B bb.c={} B.c={}".format(bb.c, B.c))
except AttributeError as e:
debug_print(e)
pass
@@ -68,7 +62,7 @@ except AttributeError as e:
cc = python_nondynamic.C()
cc.d = 3
-# An inconsistency between builtin and (non-builtin/modern).
+# An inconsistency between builtin and non-builtin.
# Class variables cannot be set on builtin types, like other Python builtins, eg list.classvar=111 fails
if python_nondynamic.is_python_builtin():
try:
@@ -80,8 +74,8 @@ if python_nondynamic.is_python_builtin():
else:
python_nondynamic.C.classvar = 111
-if is_python_modern() and not python_nondynamic.is_python_builtin():
- # Not working with builtin or non-modern :(
+if not python_nondynamic.is_python_builtin():
+ # Not working with builtin :(
try:
B.a = 10
raise RuntimeError("B should not allow adding a class variable by setting it as an instance variable")
@@ -99,9 +93,7 @@ if is_python_modern() and not python_nondynamic.is_python_builtin():
if not python_nondynamic.is_python_builtin():
try:
bb.cc = 3
- print("bb.cc = {}".format(bb.cc))
- print("B.cc = {}".format(B.cc))
- raise RuntimeError("B.cc class variable messes up nondynamic-ness of B")
+ raise RuntimeError("B.cc class variable messes up nondynamic-ness of B bb.cc={} B.cc={}".format(bb.cc, B.cc))
except AttributeError as e:
debug_print(e)
pass