Home / Function/ test_blueprint_specific_user_error_handling() — flask Function Reference

test_blueprint_specific_user_error_handling() — flask Function Reference

Architecture documentation for the test_blueprint_specific_user_error_handling() function in test_blueprints.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  2cc9a001_b04b_b470_3abe_f36647232375["test_blueprint_specific_user_error_handling()"]
  4366a441_d387_52f9_ec8d_1c41c71c00a8["test_blueprints.py"]
  2cc9a001_b04b_b470_3abe_f36647232375 -->|defined in| 4366a441_d387_52f9_ec8d_1c41c71c00a8
  style 2cc9a001_b04b_b470_3abe_f36647232375 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_blueprints.py lines 46–77

def test_blueprint_specific_user_error_handling(app, client):
    class MyDecoratorException(Exception):
        pass

    class MyFunctionException(Exception):
        pass

    blue = flask.Blueprint("blue", __name__)

    @blue.errorhandler(MyDecoratorException)
    def my_decorator_exception_handler(e):
        assert isinstance(e, MyDecoratorException)
        return "boom"

    def my_function_exception_handler(e):
        assert isinstance(e, MyFunctionException)
        return "bam"

    blue.register_error_handler(MyFunctionException, my_function_exception_handler)

    @blue.route("/decorator")
    def blue_deco_test():
        raise MyDecoratorException()

    @blue.route("/function")
    def blue_func_test():
        raise MyFunctionException()

    app.register_blueprint(blue)

    assert client.get("/decorator").data == b"boom"
    assert client.get("/function").data == b"bam"

Subdomains

Frequently Asked Questions

What does test_blueprint_specific_user_error_handling() do?
test_blueprint_specific_user_error_handling() is a function in the flask codebase, defined in tests/test_blueprints.py.
Where is test_blueprint_specific_user_error_handling() defined?
test_blueprint_specific_user_error_handling() is defined in tests/test_blueprints.py at line 46.

Analyze Your Own Codebase

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

Try Supermodel Free