f | class Tester: | f | class Tester: |
| | | |
n | def __init__(self, fun): | n | def __init__(self, f): |
| self.fun = fun | | self.func = f |
| | | |
n | def __call__(self, suite, allowed=[]): | n | def __call__(self, args, exc=[]): |
| had_allowed_exceptions = False | | allowedExc = False |
| for args in suite: | | for arg in args: |
| try: | | try: |
n | self.fun(*args) | n | self.func(*arg) |
| except tuple(allowed) as E: | | except tuple(exc) as e: |
| had_allowed_exceptions = True | | allowedExc = True |
| except: | | except Exception as e: |
| return 1 | | return 1 |
t | return -1 if had_allowed_exceptions else 0 | t | return -1 if allowedExc else 0 |