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

Function test_user_error_handling

tests/test_basic.py:944–957  ·  view source on GitHub ↗
(app, client)

Source from the content-addressed store, hash-verified

942
943
944def test_user_error_handling(app, client):
945 class MyException(Exception):
946 pass
947
948 @app.errorhandler(MyException)
949 def handle_my_exception(e):
950 assert isinstance(e, MyException)
951 return "42"
952
953 @app.route("/")
954 def index():
955 raise MyException()
956
957 assert client.get("/").data == b"42"
958
959
960def test_http_error_subclass_handling(app, client):

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected