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

Function test_remove_method_from_parent

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

Source from the content-addressed store, hash-verified

224
225
226def test_remove_method_from_parent(app, client):
227 class GetView(flask.views.MethodView):
228 def get(self):
229 return "GET"
230
231 class OtherView(flask.views.MethodView):
232 def post(self):
233 return "POST"
234
235 class View(GetView, OtherView):
236 methods = ["GET"]
237
238 app.add_url_rule("/", view_func=View.as_view("index"))
239
240 assert client.get("/").data == b"GET"
241 assert client.post("/").status_code == 405
242 assert sorted(View.methods) == ["GET"]
243
244
245def test_init_once(app, client):

Callers

nothing calls this directly

Calls 4

as_viewMethod · 0.80
add_url_ruleMethod · 0.45
getMethod · 0.45
postMethod · 0.45

Tested by

no test coverage detected