TestFun/mvpwn | TestFun/ilyagerelyuk | ||||
---|---|---|---|---|---|
f | 1 | class Tester: | f | 1 | class Tester: |
2 | 2 | ||||
n | 3 | def __init__(self, f): | n | 3 | def __init__(self, fun): |
4 | self.fun = f | 4 | self.fun = fun | ||
5 | 5 | ||||
6 | def __call__(self, suite, allowed=[]): | 6 | def __call__(self, suite, allowed=[]): | ||
7 | res = 0 | 7 | res = 0 | ||
n | 8 | for arg in suite: | n | 8 | for par in suite: |
9 | try: | 9 | try: | ||
t | 10 | self.fun(*arg) | t | 10 | self.fun(*par) |
11 | except Exception as E: | 11 | except Exception as e: | ||
12 | if type(E) in allowed or Exception in allowed: | 12 | if type(e) in allowed or Exception in allowed: | ||
13 | res = -1 | 13 | res = -1 | ||
14 | else: | 14 | else: | ||
15 | res = 1 | 15 | res = 1 | ||
16 | break | 16 | break | ||
17 | return res | 17 | return res |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|