code: def test_static_file(self, app, req_ctx):
      # Default max_age is None.
  
      # Test with static file handler.
      rv = app.send_static_file("index.html")
      assert rv.cache_control.max_age is None
      rv.close()
  
      # Test with direct use of send_file.
      rv = flask.send_file("static/index.html")
      assert rv.cache_control.max_age is None
      rv.close()
  
      app.config["SEND_FILE_MAX_AGE_DEFAULT"] = 3600
  
      # Test with static file handler.
      rv = app.send_static_file("index.html")
      assert rv.cache_control.max_age == 3600
      rv.close()
  
      # Test with direct use of send_file.
      rv = flask.send_file("static/index.html")
      assert rv.cache_control.max_age == 3600
      rv.close()
  
      # Test with pathlib.Path.
      rv = app.send_static_file(FakePath("index.html"))
      assert rv.cache_control.max_age == 3600
      rv.close()
  
      class StaticFileApp(flask.Flask):
          def get_send_file_max_age(self, filename):
              return 10
  
      app = StaticFileApp(__name__)
  
      with app.test_request_context():
          # Test with static file handler.
          rv = app.send_static_file("index.html")
          assert rv.cache_control.max_age == 10
          rv.close()
  
          # Test with direct use of send_file.
          rv = flask.send_file("static/index.html")
          assert rv.cache_control.max_age == 10
          rv.close()
  
imports: import io
  import os
  import pytest
  import werkzeug.exceptions
  import flask
  from flask.helpers import get_debug_flag
label_desc: Use image node_id 2 for calling the TestSendfile obj's underlying member method code with example usage: obj.test_static_file(app, req_ctx) and returns: int