TestFun/aartur | TestFun/bucholga | ||||
---|---|---|---|---|---|
f | 1 | class Tester: | f | 1 | class Tester: |
2 | 2 | ||||
n | 3 | def __init__(self, f): | n | 3 | def __init__(self, func): |
4 | self.fun = f | 4 | self.func = func | ||
5 | 5 | ||||
6 | def __call__(self, suite, allowed=[]): | 6 | def __call__(self, suite, allowed=[]): | ||
n | 7 | status = 0 | n | 7 | res = 0 |
8 | for args in suite: | 8 | for item in suite: | ||
9 | try: | 9 | try: | ||
n | 10 | self.fun(*args) | n | 10 | self.func(*item) |
11 | except tuple(allowed): | 11 | except tuple(allowed): | ||
n | 12 | status = -1 | n | 12 | res = -1 |
13 | except: | 13 | except: | ||
t | 14 | status = 1 | t | 14 | res = 1 |
15 | break | ||||
16 | return status | 15 | return res |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|