| TestFun/andryha | TestFun/olya.volodina | ||||
|---|---|---|---|---|---|
| f | 1 | class Tester: | f | 1 | class Tester: |
| 2 | 2 | ||||
| n | 3 | def __init__(self, func): | n | 3 | def __init__(self, f): |
| 4 | self.func = func | 4 | self.func = f | ||
| 5 | 5 | ||||
| n | 6 | def __call__(self, suite, allowed=[]): | n | 6 | def __call__(self, args, exc=[]): |
| 7 | has_exc = False | 7 | allowedExc = False | ||
| 8 | for inp in suite: | 8 | for arg in args: | ||
| 9 | try: | 9 | try: | ||
| n | 10 | self.func(*inp) | n | 10 | self.func(*arg) |
| 11 | except tuple(allowed) as e: | 11 | except tuple(exc) as e: | ||
| 12 | has_exc = True | 12 | allowedExc = True | ||
| 13 | except Exception as e: | 13 | except Exception as e: | ||
| 14 | return 1 | 14 | return 1 | ||
| t | 15 | if has_exc: | t | 15 | return -1 if allowedExc else 0 |
| 16 | return -1 | ||||
| 17 | else: | ||||
| 18 | return 0 | ||||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||