code: def test_enter_mode():
      from ...config import option_context, options
  
      @enter_mode(kernel=True)
      def wrapped():
          return is_eager_mode()
  
      assert not options.eager_mode
      assert not wrapped()
  
      with option_context({"eager_mode": True}):
          assert options.eager_mode
          assert not wrapped()
  
      @enter_mode(kernel=True)
      def wrapped2():
          wrapped()
          with option_context({"eager_mode": True}):
              assert options.eager_mode
              assert not is_eager_mode()
              with enter_mode(kernel=False):
                  assert not is_kernel_mode()
              assert is_kernel_mode()
  
      wrapped2()
  
      assert not is_kernel_mode()
      assert not is_build_mode()
  
      @enter_mode(kernel=False)
      def wrapped3():
          wrapped()
          with option_context({"eager_mode": True}):
              assert options.eager_mode
              assert not is_kernel_mode()
              with enter_mode(kernel=True, build=True):
                  assert is_kernel_mode()
                  assert is_build_mode()
              assert not is_kernel_mode()
              assert not is_build_mode()
              with pytest.raises(ValueError):
                  with enter_mode(kernel=True, build=True):
                      raise ValueError("meant to raise error")
              assert not is_kernel_mode()
              assert not is_build_mode()
  
              @enter_mode(kernel=True)
              def wrapped4():
                  raise ValueError("meant to raise error")
  
              with pytest.raises(ValueError):
                  wrapped4()
              assert not is_kernel_mode()
              assert not is_build_mode()
  
      wrapped3()
  
label_desc: Use image node_id 1 for calling a global function with example usage: test_enter_mode() and returns: is_eager_mode