class_docstr: Tests various generation functionalities.
  
  NOTE: Currently incomplete.
class_docstr_tok: ["Tests","various","generation","functionalities",".","NOTE",":","Currently","incomplete","."]
code: def test_full_context_block(self):
      args = [
          "--model-file",
          "zoo:unittest/transformer_generator2/model",
          "--inference",
          "beam",
          "--truncate",
          "1024",
          "--beam-context-block-ngram",
          "1",
      ]
      pp = ParlaiParser(True, True)
      agent = create_agent(pp.parse_args(args), True)
      obs = {"text": "1 2 3 4 " * 256, "episode_done": False}
      agent.observe(obs)
      batch = agent.batchify([agent.observation])
      self.assertEqual(
          agent._get_batch_context(batch)[0].tolist(),
          [5, 4, 6, 7] * 256,
      )
  
      # observe 1 more obs, context is the same (truncation)
      agent.observe(obs)
      batch = agent.batchify([agent.observation])
      self.assertEqual(
          agent._get_batch_context(batch)[0].tolist(),
          [5, 4, 6, 7] * 256,
      )
  
      # Now, set agent's beam_block_full_context
      args += ["--beam-block-full-context", "true"]
      agent2 = create_agent(pp.parse_args(args), True)
      agent2.observe(obs)
      batch = agent2.batchify([agent2.observation])
      self.assertEqual(
          agent2._get_batch_context(batch)[0].tolist(),
          [5, 4, 6, 7] * 256,
      )
  
      # observe 1 more obs, context is larger now
      agent2.observe(obs)
      batch = agent2.batchify([agent2.observation])
      self.assertEqual(
          agent2._get_batch_context(batch)[0].tolist(),
          [5, 4, 6, 7] * 256 + [3] + [5, 4, 6, 7] * 256,
      )
  
imports: import unittest
  import math
  import torch
  from parlai.core.agents import create_agent
  from parlai.core.dict import DictionaryAgent
  import parlai.utils.testing
  from parlai.core.params import ParlaiParser
  from parlai.core.torch_generator_agent import BeamSearch, GreedySearch, NucleusSampling, FactualNucleusSampling, TopKSampling, TorchGeneratorAgent
  from parlai.agents.test_agents.transformer_generator_prefix import PREFIX_TEXT
label_desc: Use image node_id 1 for calling the TestGeneration obj's underlying member method code with example usage: obj.test_full_context_block() without return types