class_docstr: Basic tests on the util functions in TorchAgent.
class_docstr_tok: ["Basic","tests","on","the","util","functions","in","TorchAgent","."]
docstr: Check that self-observe is correctly acting on labels.
docstr_tok: ["Check","that","self-observe","is","correctly","acting","on","labels","."]
code: def test_use_reply(self):
      """
      Check that self-observe is correctly acting on labels.
      """
      # default is hybrid label-model, which uses the label if it's available, and
      # otherwise the label
      # first check if there is a label available
      agent = get_agent()
      obs = Message(
          {
              "text": "Call",
              "labels": ["Response"],
              "episode_done": False,
          }
      )
      agent.observe(obs)
      _ = agent.act()
      self.assertEqual(
          agent.history.get_history_str(), "Call\nResponse"
      )
      # check if there is no label
      agent.reset()
      obs = Message({"text": "Call", "episode_done": False})
      agent.observe(obs)
      _ = agent.act()
      self.assertEqual(
          agent.history.get_history_str(),
          "Call\nEvaluating 0 (responding to [[1]])!",
      )
      # now some of the other possible values of --use-reply
      # --use-reply model. even if there is a label, we should see the model's out
      agent = get_agent(use_reply="model")
      obs = Message(
          {
              "text": "Call",
              "labels": ["Response"],
              "episode_done": False,
          }
      )
      agent.observe(obs)
      _ = agent.act()
      self.assertEqual(
          agent.history.get_history_str(), "Call\nTraining 0!"
      )
      # --use-reply none doesn't hear itself
      agent = get_agent(use_reply="none")
      obs = Message(
          {
              "text": "Call",
              "labels": ["Response"],
              "episode_done": False,
          }
      )
      agent.observe(obs)
      agent.act()
      self.assertEqual(agent.history.get_history_str(), "Call")
  
imports: import os
  import unittest
  from parlai.core.agents import create_agent_from_shared
  from parlai.utils.testing import tempdir
  from parlai.utils.misc import Message
label_desc: Use image node_id 17 for calling the TestTorchAgent obj's underlying member method code with example usage: obj.test_use_reply() without return types