| s02220725 TestFun 6406 | Алтухов Егор, 321 группа TestFun 6341 | ||||
|---|---|---|---|---|---|
| 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 | ||||
| 6 | def __call__(self, suite, allowed=()): | 6 | def __call__(self, suite, allowed=()): | ||
| n | 7 | had_exception = False | n | 7 | fl = False |
| 8 | for args in suite: | 8 | for args in suite: | ||
| 9 | try: | 9 | try: | ||
| 10 | self.fun(*args) | 10 | self.fun(*args) | ||
| 11 | except Exception as e: | 11 | except Exception as e: | ||
| n | 12 | had_exception = True | n | 12 | fl = True |
| 13 | if not isinstance(e, tuple(allowed)): | 13 | if not isinstance(e, tuple(allowed)): | ||
| 14 | return 1 | 14 | return 1 | ||
| t | 15 | if had_exception: | t | 15 | if fl: |
| 16 | return -1 | 16 | return -1 | ||
| 17 | return 0 | 17 | return 0 | ||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||