code: def test_it(category, name):
      maybe_skip(category, name)
  
      # Load spec into dict
      file = spec_dir / category / name
      spec = json.loads(file.read_text("utf8"))
  
      # Define local timezone
      local_tz = "America/New_York"
  
      # Pre-transform with DataFusion connection and convert to image
      vf.runtime.set_connection("datafusion")
      (transformed, _) = vf.runtime.pre_transform_spec(spec, local_tz)
      img_datafusion = imread(BytesIO(vega_to_png(transformed)))
  
      # Pre-transform with DuckDB connection and convert to image
      vf.runtime.set_connection("duckdb")
      (transformed, _) = vf.runtime.pre_transform_spec(spec, local_tz)
      img_duckdb = imread(BytesIO(vega_to_png(transformed)))
  
      # Compare images
      assert (
          img_datafusion.shape == img_duckdb.shape
      ), "Size mismatch between datafusion and duckdb connections"
      similarity = ssim(img_datafusion, img_duckdb, channel_axis=2)
      print(similarity)
      assert (
          similarity >= 0.998
      ), f"Similarity failed between datafusion and duckdb connections"
  
file_path: vegafusion/python/vegafusion/tests/test_pretransform_specs.py
imports: from pathlib import Path
  import json
  import vegafusion
  from vl_convert import vega_to_png
  from io import BytesIO
  import pyarrow
  from skimage.io import imread
  from skimage.metrics import structural_similarity
  import pytest
label_desc: Use image node_id 3 for calling a global function with example usage: test_it(category, name) without return types