docstr: All commands of the public API should be tracked with the correct name.
docstr_tok: ["All","commands","of","the","public","API","should","be","tracked","with","the","correct","name","."]
code: def test_public_api_commands(self):
      """All commands of the public API should be tracked with the correct name."""
      # Some commands are currently not tracked for various reasons:
      ignored_commands = {
          # We need to ignore `connection` because the `@gather_metrics` decorator is
          # attached to a helper function rather than the publicly-exported function,
          # which causes it not to be executed before an Exception is raised due to a
          # lack of required arguments.
          "connection",
          "experimental_connection",
          "spinner",
          "empty",
          "progress",
          "get_option",
      }
  
      # Create a list of all public API names in the `st` module (minus
      # the ignored commands from above).
      public_api_names = sorted(
          [
              k
              for k, v in st.__dict__.items()
              if not k.startswith("_")
              and not isinstance(v, type(st))
              and k not in ignored_commands
          ]
      )
  
      for api_name in public_api_names:
          st_func = getattr(st, api_name)
          if not callable(st_func):
              continue
  
          # Reset tracked stats from previous calls.
          ctx = get_script_run_ctx()
          assert ctx is not None
          ctx.reset()
          ctx.gather_usage_stats = True
  
          # Call the API. This will often throw an exception due to missing
          # arguments. But that's fine: the command will still be tracked.
          with contextlib.suppress(Exception):
              st_func()
  
          # Assert that the API name is in the list of tracked commands.
          # (It's possible for multiple tracked commands to be issued as
          # the result of a single API call.)
          self.assertIn(
              api_name,
              [cmd.name for cmd in ctx.tracked_commands],
              (
                  f"When executing `st.{api_name}()`, we expect the string "
                  f'"{api_name}" to be in the list of tracked commands.',
              ),
          )
  
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 7 for calling the PageTelemetryTest obj's underlying member method code with example usage: obj.test_public_api_commands() without return types