Improve testing of %pythonprepend and %pythonappend

This commit is contained in:
William S Fulton 2013-07-02 20:00:17 +01:00
commit 1c44078751
2 changed files with 24 additions and 2 deletions

View file

@ -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
}