code: def test_register():
      with pytest.raises(KeyError):
          settings.get("test_setting")
  
      @settings.register(
          "test_setting", "tests.test_settings", "_TEST_SETTING"
      )
      def _validate(value):
          assert isinstance(value, float)
          assert 0 < value
  
      # Test simple get and set.
      assert settings.get("test_setting") == 0.1
      settings.set(test_setting=0.2)
      assert settings.get("test_setting") == 0.2
      with pytest.raises(AssertionError):
          settings.set(test_setting=-0.1)
  
      # Test context manager.
      with settings.context(test_setting=0.3):
          assert settings.get("test_setting") == 0.3
      assert settings.get("test_setting") == 0.2
  
      # Test decorator.
      @settings.context(test_setting=0.4)
      def fn():
          assert settings.get("test_setting") == 0.4
  
      fn()
      assert settings.get("test_setting") == 0.2
  
imports: import pytest
  from pyro import settings
label_desc: Use image node_id 2 for calling a global function with example usage: test_register() without return types