MCPcopy Create free account
hub / github.com/pallets/flask / test_handle_generic

Method test_handle_generic

tests/test_user_error_handler.py:283–295  ·  view source on GitHub ↗

Generic ``Exception`` will handle all exceptions directly, including ``HTTPExceptions``.

(self, app, client)

Source from the content-addressed store, hash-verified

281 assert client.get("/not-found").data == b"404"
282
283 def test_handle_generic(self, app, client):
284 """Generic ``Exception`` will handle all exceptions directly,
285 including ``HTTPExceptions``.
286 """
287
288 @app.errorhandler(Exception)
289 def handle_exception(e):
290 return self.report_error(e)
291
292 assert client.get("/custom").data == b"direct Custom"
293 assert client.get("/error").data == b"direct KeyError"
294 assert client.get("/abort").data == b"direct InternalServerError"
295 assert client.get("/not-found").data == b"direct NotFound"

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected