code: def test_eval_fixed_label_not_in_cands(self):
      # test where cands during eval do not contain test label
      args = self._get_args()
      args[
          "model"
      ] = "parlai.agents.transformer.polyencoder:IRFriendlyPolyencoderAgent"
      args["eval_candidates"] = "fixed"
  
      teacher = CandidateTeacher({"datatype": "train"})
      all_cands = teacher.train + teacher.val + teacher.test
      train_val_cands = teacher.train + teacher.val
      all_cands_str = "\n".join([" ".join(x) for x in all_cands])
      train_val_cands_str = "\n".join(
          [" ".join(x) for x in train_val_cands]
      )
  
      with testing_utils.tempdir() as tmpdir:
          tmp_cands_file = os.path.join(tmpdir, "all_cands.text")
          with open(tmp_cands_file, "w") as f:
              f.write(all_cands_str)
          tmp_train_val_cands_file = os.path.join(
              tmpdir, "train_val_cands.text"
          )
          with open(tmp_train_val_cands_file, "w") as f:
              f.write(train_val_cands_str)
          args["fixed_candidates_path"] = tmp_cands_file
          args[
              "encode_candidate_vecs"
          ] = False  # don't encode before training
          args["ignore_bad_candidates"] = False
          args["model_file"] = os.path.join(tmpdir, "model")
          args["dict_file"] = os.path.join(tmpdir, "model.dict")
          args["num_epochs"] = 4
          args["add_label_to_fixed_cands"] = False
          # Train model where it has access to the candidate in labels
          valid, test = testing_utils.train_model(args)
          self.assertGreaterEqual(valid["hits@100"], 0.0)
  
          # Evaluate model where label is not in fixed candidates
          args["fixed_candidates_path"] = tmp_train_val_cands_file
  
          # need these args dropped, it was for train only
          del args["num_epochs"]
          del args["validation_patience"]
          del args["validation_every_n_epochs"]
          # use validation set that doesn't overlap
          args["task"] = "integration_tests"
  
          # Will fail without appropriate arg set
          with self.assertRaises(RuntimeError):
              testing_utils.eval_model(args, skip_valid=True)
  
          args["add_label_to_fixed_cands"] = True
          _, test = testing_utils.eval_model(args, skip_valid=True)
          self.assertGreaterEqual(test["hits@100"], 0.0)
  
imports: import os
  import pytest
  import unittest
  import parlai.utils.testing
  from parlai.tasks.integration_tests.agents import CandidateTeacher
label_desc: Use image node_id 3 for calling the TestPolyRanker obj's underlying member method code with example usage: obj.test_eval_fixed_label_not_in_cands() without return types