code: def test_compound_chart_examples(
      filename, all_rows, all_cols, to_reconstruct
  ):
      source = pkgutil.get_data(
          examples_methods_syntax.__name__, filename
      )
      chart = eval_block(source)
      if to_reconstruct:
          # When reconstructing a Chart, Altair uses different classes
          # then what might have been originally used. See
          # https://github.com/hex-inc/vegafusion/issues/354 for more info.
          chart = alt.Chart.from_dict(chart.to_dict())
      dfs = chart.transformed_data()
  
      if not to_reconstruct:
          # Only run assert statements if the chart is not reconstructed. Reason
          # is that for some charts, the original chart contained duplicated datasets
          # which disappear when reconstructing the chart.
          assert len(dfs) == len(all_rows)
          for df, rows, cols in zip(dfs, all_rows, all_cols):
              assert len(df) == rows
              assert set(cols).issubset(set(df.columns))
  
file_path: altair/tests/test_transformed_data.py
imports: import pkgutil
  import pytest
  from vega_datasets import data
  import altair
  from altair.utils.execeval import eval_block
  from tests import examples_methods_syntax
label_desc: Use image node_id 2 for calling a global function with example usage: test_compound_chart_examples(filename, all_rows, all_cols, to_reconstruct) without return types