ocean #1459(2007/07/26 09:19 GMT) [ Python ] Rating0/0=0.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
import types class A: def __init__(self): self.bar = 0 self.test_bar = 1 self.baz = [] self.test_baz = {} def foo(self): print "foo" def test_foo(self): print "test_foo" def boo(self): print "boo" def test_boo(self): print "test_boo" def call_tests(obj): for name in dir(obj): if name.startswith("test_"): attr = getattr(obj, name) if isinstance(attr, types.MethodType): attr() def main(): call_tests(A()) if __name__ == '__main__': main()
Rating0/0=0.00-0+
1 reply [ reply ]
ocean
#1459()
[
Python
]
Rating0/0=0.00
Rating0/0=0.00-0+
1 reply [ reply ]