code: def test_select() -> None:
      # we aren't trying to replace test_query here, only test
      # our wrappers around it, so no need to try every kind of
      # query
      d = document.Document()
      root1 = SomeModel(a=42, name="a")
      root2 = SomeModel(a=43, name="c")
      root3 = SomeModel(a=44, name="d")
      root4 = SomeModel(a=45, name="d")
      d.add_root(root1)
      d.add_root(root2)
      d.add_root(root3)
      d.add_root(root4)
  
      # select()
      assert {root1} == set(root1.select(dict(a=42)))
      assert {root1} == set(root1.select(dict(name="a")))
      assert {root2} == set(root2.select(dict(name="c")))
      assert set() == set(root1.select(dict(name="nope")))
  
      # select() on object
      assert set() == set(root3.select(dict(name="a")))
      assert {root3} == set(root3.select(dict(a=44)))
  
      # select_one()
      assert root3 == root3.select_one(dict(name="d"))
      assert root1.select_one(dict(name="nope")) is None
  
      with pytest.raises(ValueError) as e:
          d.select_one(dict(name="d"))
      assert "Found more than one" in repr(e)
  
      # select_one() on object
      assert root3.select_one(dict(name="a")) is None
      assert root3.select_one(dict(name="c")) is None
  
      # set_select()
      root1.set_select(dict(a=42), dict(name="c", a=44))
      assert {root1} == set(root1.select(dict(name="c")))
      assert {root1} == set(root1.select(dict(a=44)))
  
      # set_select() on object
      root3.set_select(dict(name="d"), dict(a=57))
      assert {root3} == set(root3.select(dict(a=57)))
  
      # set_select() on class
      root2.set_select(SomeModel, dict(name="new_name"))
      assert {root2} == set(root2.select(dict(name="new_name")))
  
imports: from __future__ import annotations
  import pytest
  from bokeh.core.has_props import is_abstract
  from bokeh.core.properties import Int, List, String
  from bokeh.core.types import ID
  from bokeh.models import *
  from bokeh.models import CustomJS
  from bokeh.plotting import *
  from bokeh.document import document
  from bokeh.model import Model
label_desc: Use image node_id 2 for calling a global function with example usage: test_select() without return types