| f | class Tester: | f | class Tester: |
| | | |
| def __init__(self, fun): | | def __init__(self, fun): |
| self.fun = fun | | self.fun = fun |
| | | |
| n | def __call__(self, suite, allowed=()): | n | def __call__(self, suite, allowed=[]): |
| had_exc = False | | flag = False |
| for args in suite: | | for args in suite: |
| try: | | try: |
| self.fun(*args) | | self.fun(*args) |
| except Exception as e: | | except Exception as e: |
| n | had_exc = True | n | flag = True |
| if not any((isinstance(e, a) for a in allowed)): | | if not any((isinstance(e, a) for a in allowed)): |
| return 1 | | return 1 |
| t | return -1 if had_exc else 0 | t | return -1 if flag else 0 |