class_docstr: Test ParlaiParser.
class_docstr_tok: ["Test","ParlaiParser","."]
docstr: Test whether upgrade_opt works.
docstr_tok: ["Test","whether","upgrade_opt","works","."]
code: def test_upgrade_opt(self):
      """
      Test whether upgrade_opt works.
      """
      with testing_utils.tempdir() as tmp:
          modfn = os.path.join(tmp, "model")
          with open(modfn, "w") as f:
              f.write("Test.")
          optfn = modfn + ".opt"
          base_opt = {
              "model": "tests.test_params:_ExampleUpgradeOptAgent",
              "dict_file": modfn + ".dict",
              "model_file": modfn,
          }
          with open(optfn, "w") as f:
              json.dump(base_opt, f)
  
          pp = ParlaiParser(True, True)
          opt = pp.parse_args(["--model-file", modfn])
          agents.create_agent(opt)
  
imports: import os
  import json
  import unittest
  from parlai.core.params import ParlaiParser
  import parlai.core.agents
  import parlai.utils.testing
label_desc: Use image node_id 3 for calling the TestParlaiParser obj's underlying member method code with example usage: obj.test_upgrade_opt() without return types