Check that async exception handlers are accepted by type checkers. We annotate the handlers' exceptions with plain `Exception` to avoid variance issues when using other exception types.
()
| 208 | |
| 209 | |
| 210 | def test_handlers_annotations() -> None: |
| 211 | """Check that async exception handlers are accepted by type checkers. |
| 212 | |
| 213 | We annotate the handlers' exceptions with plain `Exception` to avoid variance issues |
| 214 | when using other exception types. |
| 215 | """ |
| 216 | |
| 217 | async def async_catch_all_handler(request: Request, exc: Exception) -> JSONResponse: |
| 218 | raise NotImplementedError |
| 219 | |
| 220 | def sync_catch_all_handler(request: Request, exc: Exception) -> JSONResponse: |
| 221 | raise NotImplementedError |
| 222 | |
| 223 | ExceptionMiddleware(router, handlers={Exception: sync_catch_all_handler}) |
| 224 | ExceptionMiddleware(router, handlers={Exception: async_catch_all_handler}) |
nothing calls this directly
no test coverage detected