class_docstr: Test functionality related to --init-opt.
class_docstr_tok: ["Test","functionality","related","to","--","init-opt","."]
docstr: Test --init-opt.
docstr_tok: ["Test","--","init-opt","."]
code: def test_init_opt(self):
      """
      Test --init-opt.
      """
  
      with testing_utils.tempdir() as temp_dir:
          init_opt_path = os.path.join(temp_dir, "init_opt.opt")
          test_model_file = "/test_model_path/model"
  
          # Save a test opt file
          init_opt = Opt({"model_file": test_model_file})
          init_opt.save(init_opt_path)
  
          # Load the opt back in with --init-opt and make sure it's been set
          # correctly
          opt = ParlaiParser(True, True).parse_kwargs(
              init_opt=init_opt_path
          )
          self.assertEqual(opt["model_file"], test_model_file)
  
imports: import json
  import os
  import unittest
  import parlai.utils.testing
  from parlai.core.agents import create_agent_from_opt_file
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.scripts.compare_opts import compare_opts
label_desc: Use image node_id 1 for calling the TestInitOpt obj's underlying member method code with example usage: obj.test_init_opt() without return types