code: def get_app(self):
      self.mock_stats = []
      mock_stats_manager = MagicMock()
      mock_stats_manager.get_stats = MagicMock(
          side_effect=lambda: self.mock_stats
      )
      return tornado.web.Application(
          [
              (
                  rf"/{METRIC_ENDPOINT}",
                  StatsRequestHandler,
                  dict(stats_manager=mock_stats_manager),
              )
          ]
      )
  
file_path: streamlit/lib/tests/streamlit/web/server/stats_handler_test.py
imports: from unittest.mock import MagicMock
  import tornado.testing
  import tornado.web
  from google.protobuf.json_format import MessageToDict
  from tornado.httputil import HTTPHeaders
  from streamlit.proto.openmetrics_data_model_pb2 import MetricSet
  from streamlit.runtime.stats import CacheStat
  from streamlit.web.server.server import METRIC_ENDPOINT
  from streamlit.web.server.stats_request_handler import StatsRequestHandler
label_desc: Use image node_id 1 for calling the StatsHandlerTest obj's underlying member method code with example usage: obj.get_app() and returns: tornado