Test-suite fixes for python -classic
These are mostly workarounds for static class members not being supported for old style classes, as documented in Python.html, "C++ classes".
This commit is contained in:
parent
39a75442a1
commit
76bcec1d87
18 changed files with 118 additions and 41 deletions
|
|
@ -1,7 +1,16 @@
|
|||
#!/usr/bin/evn python
|
||||
from cpp_static import *
|
||||
StaticFunctionTest.static_func()
|
||||
StaticFunctionTest.static_func_2(1)
|
||||
StaticFunctionTest.static_func_3(1,2)
|
||||
|
||||
def is_new_style_class(cls):
|
||||
return hasattr(cls, "__class__")
|
||||
|
||||
if is_new_style_class(StaticFunctionTest):
|
||||
StaticFunctionTest.static_func()
|
||||
StaticFunctionTest.static_func_2(1)
|
||||
StaticFunctionTest.static_func_3(1,2)
|
||||
else:
|
||||
StaticFunctionTest().static_func()
|
||||
StaticFunctionTest().static_func_2(1)
|
||||
StaticFunctionTest().static_func_3(1,2)
|
||||
StaticMemberTest.static_int = 10
|
||||
assert StaticMemberTest.static_int == 10
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue