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

Function test_methods_var_inheritance

tests/test_views.py:189–204  ·  view source on GitHub ↗
(app, client)

Source from the content-addressed store, hash-verified

187
188
189def test_methods_var_inheritance(app, client):
190 class BaseView(flask.views.MethodView):
191 methods = ["GET", "PROPFIND"]
192
193 class ChildView(BaseView):
194 def get(self):
195 return "GET"
196
197 def propfind(self):
198 return "PROPFIND"
199
200 app.add_url_rule("/", view_func=ChildView.as_view("index"))
201
202 assert client.get("/").data == b"GET"
203 assert client.open("/", method="PROPFIND").data == b"PROPFIND"
204 assert ChildView.methods == {"PROPFIND", "GET"}
205
206
207def test_multiple_inheritance(app, client):

Callers

nothing calls this directly

Calls 4

as_viewMethod · 0.80
openMethod · 0.80
add_url_ruleMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected