| f | class Tester: | f | class Tester: |
| | | |
| def __init__(self, fun): | | def __init__(self, fun): |
| self.fun = fun | | self.fun = fun |
| | | |
| def __call__(self, suite, allowed=()): | | def __call__(self, suite, allowed=()): |
| n | had_allowed = False | n | has_allowed_error = 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: |
| if any((isinstance(e, a) for a in allowed)): | | if any((isinstance(e, a) for a in allowed)): |
| n | had_allowed = True | n | has_allowed_error = True |
| else: | | else: |
| return 1 | | return 1 |
| t | return -1 if had_allowed else 0 | t | return -1 if has_allowed_error else 0 |