diff --git a/Examples/test-suite/python/python_append_runme.py b/Examples/test-suite/python/python_append_runme.py index c8e6b2640..41cebad58 100644 --- a/Examples/test-suite/python/python_append_runme.py +++ b/Examples/test-suite/python/python_append_runme.py @@ -2,3 +2,10 @@ from python_append import * t=Test() t.func() t.static_func() + +if grabpath() != os.path.dirname(mypath): + raise RuntimeError + +if grabstaticpath() != os.path.basename(mypath): + raise RuntimeError + diff --git a/Examples/test-suite/python_append.i b/Examples/test-suite/python_append.i index 2dc9cb970..82d1012ef 100644 --- a/Examples/test-suite/python_append.i +++ b/Examples/test-suite/python_append.i @@ -4,19 +4,34 @@ Testcase to test %pythonprepend and %pythonappend %module python_append +%pythoncode %{ + import os.path + mypath = os.path.dirname("/a/b/c/d.txt") + funcpath = None + staticfuncpath = None + def grabpath(): + return funcpath + def grabstaticpath(): + return staticfuncpath +%} + %pythonappend Test::func %{ - pass + funcpath = os.path.dirname(funcpath) %} %pythonprepend Test::func %{ - pass + global funcpath + funcpath = mypath %} %pythonappend Test::static_func %{ +staticfuncpath = os.path.basename(staticfuncpath) pass %} %pythonprepend Test::static_func { + global staticfuncpath + staticfuncpath = mypath pass }