swig/Examples/test-suite/python/python_append_runme.py
Alec Cooper b45164e098 Support python(pre|ap)pend on static methods in classic mode
Adding a test that covers this case to the python_append test-suite
Note: staticmethod function has been available since Python 2.2
2016-02-04 15:27:54 -05:00

29 lines
670 B
Python

from python_append import *
def is_new_style_class(cls):
return hasattr(cls, "__class__")
# test not relevant for -builtin
if is_python_builtin():
exit(0)
t = Test()
t.func()
if is_new_style_class(Test):
t.static_func()
else:
Test_static_func()
if grabpath() != os.path.dirname(mypath):
raise RuntimeError("grabpath failed")
if grabstaticpath() != os.path.basename(mypath):
raise RuntimeError("grabstaticpath failed")
clearstaticpath()
if grabstaticpath() != None:
raise RuntimeError("Resetting staticfuncpath failed")
Test.static_func()
if grabstaticpath() != os.path.basename(mypath):
raise RuntimeError("grabstaticpath failed")