| f | class Tester: | f | class Tester: |
| | | |
| n | def __init__(self, fun): | n | def __init__(self, func): |
| self.fun = fun | | self.func = func |
| | | |
| def __call__(self, suite, allowed=()): | | def __call__(self, suite, allowed=()): |
| n | allowed_flag = False | n | allowed_found = False |
| bad_flag = False | | bad_found = False |
| for args_tuple in suite: | | for args in suite: |
| try: | | try: |
| n | self.fun(*args_tuple) | n | self.func(*args) |
| except Exception as e: | | except Exception as e: |
| n | if any((isinstance(e, exc_class) for exc_class in allowe | n | if any((isinstance(e, exc) for exc in allowed)): |
| d)): | | |
| allowed_flag = True | | allowed_found = True |
| else: | | else: |
| n | bad_flag = True | n | bad_found = True |
| if bad_flag: | | if bad_found: |
| return 1 | | return 1 |
| t | elif allowed_flag: | t | elif allowed_found: |
| return -1 | | return -1 |
| else: | | else: |
| return 0 | | return 0 |