code: def test_selection_to_dict():
      brush = alt.selection_interval()
  
      # test some value selections
      # Note: X and Y cannot have conditions
      alt.Chart("path/to/data.json").mark_point().encode(
          color=alt.condition(
              brush, alt.ColorValue("red"), alt.ColorValue("blue")
          ),
          opacity=alt.condition(brush, alt.value(0.5), alt.value(1.0)),
          text=alt.condition(
              brush, alt.TextValue("foo"), alt.value("bar")
          ),
      ).to_dict()
  
      # test some field selections
      # Note: X and Y cannot have conditions
      # Conditions cannot both be fields
      alt.Chart("path/to/data.json").mark_point().encode(
          color=alt.condition(
              brush, alt.Color("col1:N"), alt.value("blue")
          ),
          opacity=alt.condition(brush, "col1:N", alt.value(0.5)),
          text=alt.condition(
              brush, alt.value("abc"), alt.Text("col2:N")
          ),
          size=alt.condition(brush, alt.value(20), "col2:N"),
      ).to_dict()
  
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 8 for calling a global function with example usage: test_selection_to_dict() without return types