code: def test_process_response():
      encoder = TestEncoder()
  
      def test_response(
          h, response, expected_processed, expected_decoded
      ):
          response_encoder = tasks.ResponseEncoder(h, encoder)
  
          processed_tensor = response_encoder.process_responses(
              torch.LongTensor([response])
          )
          processed = processed_tensor.numpy()[0]
          assert_eq(processed, expected_processed)
  
          decoded = response_encoder.decode_response(processed)
          assert_eq(decoded, expected_decoded)
          assert_eq(
              processed,
              response_encoder.encode_response(expected_decoded),
          )
          decoded = response_encoder.decode_responses(processed_tensor)
          assert_eq(decoded, [expected_decoded])
  
      test_response(
          tasks.TaskResponseHParams(length=10, truncate_token=None),
          encoder.encode("123456789a"),
          encoder.encode("123456789a"),
          "123456789a",
      )
  
      test_response(
          tasks.TaskResponseHParams(length=10, truncate_token=ord("5")),
          encoder.encode("123456789a"),
          encoder.encode("12345") + [PADDING_TOKEN] * 5,
          "1234",
      )
  
file_path: summarize-from-feedback/summarize_from_feedback/test_tasks.py
imports: import pytest
  import torch
  from summarize_from_feedback import tasks
  from summarize_from_feedback.query_response_model import PADDING_TOKEN
  from summarize_from_feedback.utils.assertions import assert_eq
label_desc: Use image node_id 2 for calling a global function with example usage: test_process_response() without return types