docstr: Command tracking limits should be respected.
  
  Current limits are 25 per unique command and 200 in total.
docstr_tok: ["Command","tracking","limits","should","be","respected",".","Current","limits","are","25","per","unique","command","and","200","in","total","."]
code: def test_command_tracking_limits(self):
      """Command tracking limits should be respected.
  
      Current limits are 25 per unique command and 200 in total.
      """
      ctx = get_script_run_ctx()
      assert ctx is not None
      ctx.reset()
      ctx.gather_usage_stats = True
  
      funcs = []
      for i in range(10):
  
          def test_function() -> str:
              return "foo"
  
          funcs.append(
              metrics_util.gather_metrics(
                  f"test_function_{i}", test_function
              )
          )
  
      for _ in range(metrics_util._MAX_TRACKED_PER_COMMAND + 1):
          for func in funcs:
              func()
  
      self.assertLessEqual(
          len(ctx.tracked_commands), metrics_util._MAX_TRACKED_COMMANDS
      )
  
      # Test that no individual command is tracked more than _MAX_TRACKED_PER_COMMAND
      command_counts = Counter(
          [command.name for command in ctx.tracked_commands]
      ).most_common()
      self.assertLessEqual(
          command_counts[0][1], metrics_util._MAX_TRACKED_PER_COMMAND
      )
  
imports: import contextlib
  import datetime
  import unittest
  from collections import Counter
  from typing import Any, Callable
  from unittest.mock import MagicMock, mock_open, patch
  import pandas
  from parameterized import parameterized
  import streamlit
  import streamlit.components.v1
  from streamlit.connections import SnowparkConnection, SQLConnection
  from streamlit.runtime import metrics_util
  from streamlit.runtime.caching import cache_data_api, cache_resource_api
  from streamlit.runtime.legacy_caching import caching
  from streamlit.runtime.scriptrunner import get_script_run_ctx, magic_funcs
  from streamlit.web.server import websocket_headers
  from tests.delta_generator_test_case import DeltaGeneratorTestCase
label_desc: Use image node_id 9 for calling the PageTelemetryTest obj's underlying member method code with example usage: obj.test_command_tracking_limits() and returns: str