code: def test_chart_data_types():
      def Chart(data):
          return alt.Chart(data).mark_point().encode(x="x:Q", y="y:Q")
  
      # Url Data
      data = "/path/to/my/data.csv"
      dct = Chart(data).to_dict()
      assert dct["data"] == {"url": data}
  
      # Dict Data
      data = {"values": [{"x": 1, "y": 2}, {"x": 2, "y": 3}]}
      with alt.data_transformers.enable(consolidate_datasets=False):
          dct = Chart(data).to_dict()
      assert dct["data"] == data
  
      with alt.data_transformers.enable(consolidate_datasets=True):
          dct = Chart(data).to_dict()
      name = dct["data"]["name"]
      assert dct["datasets"][name] == data["values"]
  
      # DataFrame data
      data = pd.DataFrame({"x": range(5), "y": range(5)})
      with alt.data_transformers.enable(consolidate_datasets=False):
          dct = Chart(data).to_dict()
      assert dct["data"]["values"] == data.to_dict(orient="records")
  
      with alt.data_transformers.enable(consolidate_datasets=True):
          dct = Chart(data).to_dict()
      name = dct["data"]["name"]
      assert dct["datasets"][name] == data.to_dict(orient="records")
  
      # Named data object
      data = alt.NamedData(name="Foo")
      dct = Chart(data).to_dict()
      assert dct["data"] == {"name": "Foo"}
  
imports: import io
  import json
  import operator
  import os
  import pathlib
  import tempfile
  import jsonschema
  import pytest
  import pandas
  import altair.vegalite.v5
label_desc: Use image node_id 4 for calling a global function with example usage: test_chart_data_types() and returns: alt