code: def test_keep_model_space():
      model_space = MyModelSpace()
      evaluator = FunctionalEvaluator(
          foo, a=Categorical([0, 1], label="c")
      )
      exec_model = RawFormatModelSpace.from_model(
          model_space, evaluator
      )
      assert repr(exec_model) == str(exec_model)
      assert exec_model.sample is None
      assert exec_model.status == ModelStatus.Initialized
      assert exec_model.metric is None
      with pytest.raises(NotImplementedError):
          exec_model._dump()
      assert _mutable_equal(
          exec_model.simplify(),
          {
              "a": Categorical([1, 2, 3], label="a"),
              "b": Categorical([4, 5, 6, 7], label="b"),
              "c": Categorical([0, 1], label="c"),
          },
      )
  
      assert exec_model.contains({"a": 1, "b": 4, "c": -1}) is False
      assert exec_model.contains({"a": 0, "b": 4, "c": 0}) is False
  
      assert repr(exec_model).startswith(
          "RawFormatModelSpace(model_space=MyModelSpace(), evaluator=FunctionalEvaluator(<function foo at "
      )
      if sys.platform == "linux":
          # Otherwise trace will make the repr different
          assert repr(exec_model).endswith(
              ">, arguments={'a': Categorical([0, 1], label='c')})), status=ModelStatus.Initialized)"
          )
      frozen_model = exec_model.freeze({"a": 2, "b": 6, "c": 1})
      assert frozen_model.status == ModelStatus.Frozen
      assert frozen_model.sample == {"a": 2, "b": 6, "c": 1}
      assert (
          frozen_model.evaluator.evaluate(
              frozen_model.executable_model()
          )
          == 9
      )
      frozen_model.metrics.add_intermediate(1)
      frozen_model.metrics.final = 2
      assert repr(frozen_model).endswith(
          ", metrics=Metrics(intermediates=<array of length 1>, final=2.0), status=ModelStatus.Frozen)"
      )
      assert (
          str(frozen_model)
          == "RawFormatModelSpace({'a': 2, 'b': 6, 'c': 1}, Metrics(intermediates=<array of length 1>, final=2.0), 'frozen')"
      )
  
      with pytest.raises(RuntimeError, match="not initialized"):
          frozen_model.freeze({"a": 1, "b": 5, "c": 0})
  
file_path: nni/test/ut/nas/space/test_executable_space.py
imports: import sys
  import pytest
  import nni
  from nni.mutable import *
  from nni.mutable.mutable import _mutable_equal
  from nni.nas.evaluator import FunctionalEvaluator, FrozenEvaluator
  from nni.nas.space import *
label_desc: Use image node_id 2 for calling a global function with example usage: test_keep_model_space() without return types