code: def test_consolidate_datasets(basic_chart):
      subchart1 = basic_chart
      subchart2 = basic_chart.copy()
      subchart2.data = basic_chart.data.copy()
      chart = subchart1 | subchart2
  
      with alt.data_transformers.enable(consolidate_datasets=True):
          dct_consolidated = chart.to_dict()
  
      with alt.data_transformers.enable(consolidate_datasets=False):
          dct_standard = chart.to_dict()
  
      assert "datasets" in dct_consolidated
      assert "datasets" not in dct_standard
  
      datasets = dct_consolidated["datasets"]
  
      # two dataset copies should be recognized as duplicates
      assert len(datasets) == 1
  
      # make sure data matches original & names are correct
      name, data = datasets.popitem()
  
      for spec in dct_standard["hconcat"]:
          assert spec["data"]["values"] == data
  
      for spec in dct_consolidated["hconcat"]:
          assert spec["data"] == {"name": name}
  
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 30 for calling a global function with example usage: test_consolidate_datasets(basic_chart) without return types