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

Function test_multiple_inheritance

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

Source from the content-addressed store, hash-verified

205
206
207def test_multiple_inheritance(app, client):
208 class GetView(flask.views.MethodView):
209 def get(self):
210 return "GET"
211
212 class DeleteView(flask.views.MethodView):
213 def delete(self):
214 return "DELETE"
215
216 class GetDeleteView(GetView, DeleteView):
217 pass
218
219 app.add_url_rule("/", view_func=GetDeleteView.as_view("index"))
220
221 assert client.get("/").data == b"GET"
222 assert client.delete("/").data == b"DELETE"
223 assert sorted(GetDeleteView.methods) == ["DELETE", "GET"]
224
225
226def test_remove_method_from_parent(app, client):

Callers

nothing calls this directly

Calls 4

as_viewMethod · 0.80
add_url_ruleMethod · 0.45
getMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected