Home / Function/ test_handle_generic() — flask Function Reference

test_handle_generic() — flask Function Reference

Architecture documentation for the test_handle_generic() function in test_user_error_handler.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  41ae651d_a7f6_1444_6a45_736aa21b18e7["test_handle_generic()"]
  d43f613b_526f_83b2_b03e_180d5f56de23["TestGenericHandlers"]
  41ae651d_a7f6_1444_6a45_736aa21b18e7 -->|defined in| d43f613b_526f_83b2_b03e_180d5f56de23
  83c9c51e_e291_f343_62c6_349a614281ff["report_error()"]
  41ae651d_a7f6_1444_6a45_736aa21b18e7 -->|calls| 83c9c51e_e291_f343_62c6_349a614281ff
  style 41ae651d_a7f6_1444_6a45_736aa21b18e7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_user_error_handler.py lines 283–295

    def test_handle_generic(self, app, client):
        """Generic ``Exception`` will handle all exceptions directly,
        including ``HTTPExceptions``.
        """

        @app.errorhandler(Exception)
        def handle_exception(e):
            return self.report_error(e)

        assert client.get("/custom").data == b"direct Custom"
        assert client.get("/error").data == b"direct KeyError"
        assert client.get("/abort").data == b"direct InternalServerError"
        assert client.get("/not-found").data == b"direct NotFound"

Subdomains

Frequently Asked Questions

What does test_handle_generic() do?
test_handle_generic() is a function in the flask codebase, defined in tests/test_user_error_handler.py.
Where is test_handle_generic() defined?
test_handle_generic() is defined in tests/test_user_error_handler.py at line 283.
What does test_handle_generic() call?
test_handle_generic() calls 1 function(s): report_error.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free