code: def test_boolean():
      # Test default default
      boolean = hp_module.Boolean("bool")
      assert boolean.default is False
      # Test default setting
      boolean = hp_module.Boolean("bool", default=True)
      assert boolean.default is True
      # Wrong default type
      with pytest.raises(ValueError, match="must be a Python boolean"):
          hp_module.Boolean("bool", default=None)
      # Test serialization
      boolean = hp_module.Boolean("bool", default=True)
      boolean = hp_module.Boolean.from_config(boolean.get_config())
      assert boolean.default is True
      assert boolean.name == "bool"
  
      # Test random_sample
      assert boolean.random_sample() in {True, False}
      assert boolean.random_sample(123) == boolean.random_sample(123)
      assert {
          boolean.value_to_prob(True),
          boolean.value_to_prob(False),
      } == {
          0.25,
          0.75,
      }
  
imports: import pytest
  from keras_tuner.engine import hyperparameters
label_desc: Use image node_id 1 for calling a global function with example usage: test_boolean() without return types