(typ: type, msg: str = '')
| 43 | |
| 44 | @contextmanager |
| 45 | def assertRaises(typ: type, msg: str = '') -> Iterator[None]: |
| 46 | try: |
| 47 | yield |
| 48 | except BaseException as e: |
| 49 | assert type(e) is typ, f"{e!r} is not a {typ.__name__}" |
| 50 | assert msg in str(e), f'Message "{e}" does not match "{msg}"' |
| 51 | else: |
| 52 | assert False, f"Expected {typ.__name__} but got no exception" |
| 53 | |
| 54 | def assertDomainError() -> Any: |
| 55 | return assertRaises(ValueError, "math domain error") |
no test coverage detected
searching dependent graphs…