code: def test_sanitize_dataframe_colnames():
      df = pd.DataFrame(np.arange(12).reshape(4, 3))
  
      # Test that RangeIndex is converted to strings
      df = sanitize_dataframe(df)
      assert [isinstance(col, str) for col in df.columns]
  
      # Test that non-string columns result in an error
      df.columns = [4, "foo", "bar"]
      with pytest.raises(ValueError) as err:
          sanitize_dataframe(df)
      assert str(err.value).startswith(
          "Dataframe contains invalid column name: 4."
      )
  
file_path: altair/tests/utils/test_utils.py
imports: import io
  import json
  import warnings
  import numpy
  import pandas
  import pytest
  from altair.utils import infer_vegalite_type, sanitize_dataframe
label_desc: Use image node_id 4 for calling a global function with example usage: test_sanitize_dataframe_colnames() without return types