code: def test_init_once(app, client):
      n = 0
  
      class CountInit(flask.views.View):
          init_every_request = False
  
          def __init__(self):
              nonlocal n
              n += 1
  
          def dispatch_request(self):
              return str(n)
  
      app.add_url_rule("/", view_func=CountInit.as_view("index"))
      assert client.get("/").data == b"1"
      assert client.get("/").data == b"1"
  
file_path: flask/tests/test_views.py
imports: import pytest
  from werkzeug.http import parse_set_header
  import flask.views
label_desc: Use image node_id 14 for calling a global function with example usage: test_init_once(app, client) and returns: str