code: def test_selection():
      # test instantiation of selections
      interval = alt.selection_interval(name="selec_1")
      assert interval.param.select.type == "interval"
      assert interval.name == "selec_1"
  
      single = alt.selection_point(name="selec_2")
      assert single.param.select.type == "point"
      assert single.name == "selec_2"
  
      multi = alt.selection_point(name="selec_3")
      assert multi.param.select.type == "point"
      assert multi.name == "selec_3"
  
      # test adding to chart
      chart = alt.Chart().add_params(single)
      chart = chart.add_params(multi, interval)
      assert {x.name for x in chart.params} == {
          "selec_1",
          "selec_2",
          "selec_3",
      }
  
      # test logical operations
      assert isinstance(
          single & multi, alt.SelectionPredicateComposition
      )
      assert isinstance(
          single | multi, alt.SelectionPredicateComposition
      )
      assert isinstance(~single, alt.SelectionPredicateComposition)
      assert "and" in (single & multi).to_dict().keys()
      assert "or" in (single | multi).to_dict().keys()
      assert "not" in (~single).to_dict().keys()
  
      # test that default names increment (regression for #1454)
      sel1 = alt.selection_point()
      sel2 = alt.selection_point()
      sel3 = alt.selection_interval()
      names = {s.name for s in (sel1, sel2, sel3)}
      assert len(names) == 3
  
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 16 for calling a global function with example usage: test_selection() without return types