code: def test_tests_ui():
      ui = _UI_Switcher("dialog")
      # Let's test our responses construct
      ui.set_backend("tests")
      with ui.add_responses("abc"):
          assert_equal(ui.question("text"), "abc")
  
      with ui.add_responses(["a", "bb"]):
          assert_equal(ui.question("text"), "a")
          assert_equal(ui.question("text"), "bb")
  
      # should raise exception if not all responses were
      # used
      with assert_raises(AssertionError):
          with ui.add_responses(["a", "bb"]):
              assert_equal(ui.question("text"), "a")
  
      # but clear it up
      assert_false(ui.get_responses())
  
      # assure that still works
      with ui.add_responses("abc"):
          assert_equal(ui.question("text"), "abc")
  
      # and if we switch back to some other backend -- we would loose *responses methods
      ui.set_backend("annex")
      assert_false(hasattr(ui, "add_responses"))
  
imports: from unittest.mock import patch
  from ...tests.utils_pytest import assert_equal, assert_false, assert_not_equal, assert_raises, with_testsui
  from ..None import _UI_Switcher
  from ..dialog import ConsoleLog, DialogUI, IPythonUI
label_desc: Use image node_id 2 for calling a global function with example usage: test_tests_ui() without return types