docstr: Test that `convert_df_to_data_format` correctly converts a
  DataFrame to the specified data format.
docstr_tok: ["Test","that","`","convert_df_to_data_format","`","correctly","converts","a","DataFrame","to","the","specified","data","format","."]
code: def test_convert_df_to_data_format(
      self,
      input_data: Any,
      metadata: TestCaseMetadata,
  ):
      """Test that `convert_df_to_data_format` correctly converts a
      DataFrame to the specified data format.
      """
      converted_df = type_util.convert_anything_to_df(input_data)
      self.assertEqual(converted_df.shape[0], metadata.expected_rows)
      self.assertEqual(converted_df.shape[1], metadata.expected_cols)
  
      if metadata.expected_data_format == type_util.DataFormat.UNKNOWN:
          with self.assertRaises(ValueError):
              type_util.convert_df_to_data_format(
                  converted_df, metadata.expected_data_format
              )
          # We don't have to do any other tests for unknown data formats.
      else:
          converted_data = type_util.convert_df_to_data_format(
              converted_df, metadata.expected_data_format
          )
  
          # Some data formats are converted to DataFrames instead of
          # the original data type/structure.
          if metadata.expected_data_format in [
              type_util.DataFormat.SNOWPARK_OBJECT,
              type_util.DataFormat.PYSPARK_OBJECT,
              type_util.DataFormat.PANDAS_INDEX,
              type_util.DataFormat.PANDAS_STYLER,
              type_util.DataFormat.EMPTY,
          ]:
              assert isinstance(converted_data, pd.DataFrame)
              self.assertEqual(
                  converted_data.shape[0], metadata.expected_rows
              )
              self.assertEqual(
                  converted_data.shape[1], metadata.expected_cols
              )
          else:
              self.assertEqual(type(converted_data), type(input_data))
              # Sets in python are unordered, so we can't compare them this way.
              if (
                  metadata.expected_data_format
                  != type_util.DataFormat.SET_OF_VALUES
              ):
                  self.assertEqual(str(converted_data), str(input_data))
                  pd.testing.assert_frame_equal(
                      converted_df,
                      type_util.convert_anything_to_df(converted_data),
                  )
  
imports: import enum
  import unittest
  from collections import namedtuple
  from datetime import date
  from decimal import Decimal
  from typing import Any
  from unittest.mock import patch
  import numpy
  import pandas
  import plotly.graph_objs
  import pytest
  from pandas.api.types import infer_dtype
  from parameterized import parameterized
  from streamlit import errors, type_util
  from streamlit.errors import StreamlitAPIException
  from tests.streamlit.data_mocks import BASE_TYPES_DF, DATETIME_TYPES_DF, INTERVAL_TYPES_DF, LIST_TYPES_DF, NUMBER_TYPES_DF, PERIOD_TYPES_DF, SHARED_TEST_CASES, SPECIAL_TYPES_DF, UNSUPPORTED_TYPES_DF, TestCaseMetadata, TestObject
  from tests.streamlit.snowpark_mocks import DataFrame
  from tests.streamlit.snowpark_mocks import Row
  from tests.testutil import create_snowpark_session, patch_config_options
label_desc: Use image node_id 28 for calling the TypeUtilTest obj's underlying member method code with example usage: obj.test_convert_df_to_data_format(input_data, metadata) without return types