MCPcopy
hub / github.com/pallets/flask / test_view_patching

Function test_view_patching

tests/test_views.py:41–59  ·  view source on GitHub ↗
(app)

Source from the content-addressed store, hash-verified

39
40
41def test_view_patching(app):
42 class Index(flask.views.MethodView):
43 def get(self):
44 raise ZeroDivisionError
45
46 def post(self):
47 raise ZeroDivisionError
48
49 class Other(Index):
50 def get(self):
51 return "GET"
52
53 def post(self):
54 return "POST"
55
56 view = Index.as_view("index")
57 view.view_class = Other
58 app.add_url_rule("/", view_func=view)
59 common_test(app)
60
61
62def test_view_inheritance(app, client):

Callers

nothing calls this directly

Calls 3

common_testFunction · 0.85
as_viewMethod · 0.80
add_url_ruleMethod · 0.45

Tested by

no test coverage detected