| 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: tuple=()): | n | def __call__(self, suite, allowed=()): |
| allowed_tuple = tuple(allowed) | | allowed = tuple(allowed) |
| any_exceptions = False | | exc = False |
| any_disallowed = False | | unal = 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 | any_exceptions = True | n | exc = True |
| if not isinstance(e, allowed_tuple): | | if not isinstance(e, allowed): |
| any_disallowed = True | | unal = True |
| if any_disallowed: | | break |
| | | if unal: |
| return 1 | | return 1 |
| t | if any_exceptions: | t | if exc: |
| return -1 | | return -1 |
| return 0 | | return 0 |