TestFun/MVPakaGuru | TestFun/Beka00 | ||||
---|---|---|---|---|---|
f | 1 | class Tester: | f | 1 | class Tester: |
2 | 2 | ||||
3 | def __init__(self, fun): | 3 | def __init__(self, fun): | ||
4 | self.fun = fun | 4 | self.fun = fun | ||
5 | 5 | ||||
n | 6 | def __call__(self, suite, errs=[]): | n | 6 | def __call__(self, suite, allowed=[]): |
7 | check = 0 | 7 | position = 0 | ||
8 | for s in suite: | 8 | for sequence in suite: | ||
9 | try: | 9 | try: | ||
n | 10 | self.fun(*s) | n | 10 | self.fun(*sequence) |
11 | except Exception as ex: | 11 | except Exception as EXC: | ||
12 | check2 = 0 | 12 | position2 = 0 | ||
13 | for allowed_ex in errs: | 13 | for err in allowed: | ||
14 | if isinstance(ex, allowed_ex): | 14 | if isinstance(EXC, err): | ||
15 | check2 = 1 | 15 | position2 = 1 | ||
16 | if check2 == 1: | 16 | if position2 == 1: | ||
17 | check = max(1, check) | 17 | position = max(1, position) | ||
18 | else: | 18 | else: | ||
n | 19 | check = 2 | n | 19 | position = 2 |
20 | if check == 2: | 20 | if position == 2: | ||
21 | return 1 | 21 | return 1 | ||
t | 22 | if check == 1: | t | 22 | if position == 1: |
23 | return -1 | 23 | return -1 | ||
24 | return 0 | 24 | return 0 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|