| 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=None): | | def __call__(self, suite, allowed=None): |
| if allowed is None: | | if allowed is None: |
| allowed = [] | | allowed = [] |
| n | has_allowed = False | n | has_allowed_exception = 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, exc) for exc in allowed)): | | if any((isinstance(e, exc) for exc in allowed)): |
| n | has_allowed = True | n | has_allowed_exception = True |
| else: | | else: |
| return 1 | | return 1 |
| t | return -1 if has_allowed else 0 | t | return -1 if has_allowed_exception else 0 |