code: def test_translator_input_with_source_prefix(
      sentence_id,
      sentence,
      factors,
      chunk_size,
      source_prefix,
      source_prefix_factors,
  ):
      tokens = sentence.split()
      source_prefix_tokens = source_prefix.split()
      trans_input = sockeye.inference.TranslatorInput(
          sentence_id=sentence_id,
          tokens=tokens,
          factors=factors,
          source_prefix_tokens=source_prefix_tokens,
          source_prefix_factors=source_prefix_factors,
      )
  
      assert trans_input.sentence_id == sentence_id
      assert trans_input.tokens == tokens
      assert len(trans_input) == len(tokens) + len(source_prefix_tokens)
      assert trans_input.factors == factors
      assert trans_input.source_prefix_tokens == source_prefix_tokens
      assert trans_input.source_prefix_factors == source_prefix_factors
      if factors is not None:
          for factor in trans_input.factors:
              assert len(factor) == len(tokens)
          if trans_input.source_prefix_factors is not None:
              assert len(factors) == len(
                  trans_input.source_prefix_factors
              )
  
      chunked_inputs = list(trans_input.chunks(chunk_size))
      assert len(chunked_inputs) == ceil(len(tokens) / chunk_size)
      for chunk_id, chunk_input in enumerate(chunked_inputs):
          assert chunk_input.sentence_id == sentence_id
          assert (
              chunk_input.tokens
              == trans_input.tokens[
                  chunk_id * chunk_size : (chunk_id + 1) * chunk_size
              ]
          )
          assert (
              chunk_input.source_prefix_tokens
              == trans_input.source_prefix_tokens
          )
          assert (
              chunk_input.num_source_prefix_tokens
              == trans_input.num_source_prefix_tokens
          )
          if source_prefix_factors is not None:
              assert len(chunk_input.source_prefix_factors) == len(
                  source_prefix_factors
              )
              for (
                  chunk_input_source_prefix_factor,
                  source_prefix_factor,
              ) in zip(
                  chunk_input.source_prefix_factors,
                  trans_input.source_prefix_factors,
              ):
                  assert len(chunk_input_source_prefix_factor) == len(
                      source_prefix_factor
                  )
  
imports: import itertools
  import json
  from math import ceil
  from unittest.mock import patch, Mock
  import numpy
  import pytest
  import torch
  import sockeye.beam_search
  import sockeye.constants
  import sockeye.data_io
  import sockeye.inference
  import sockeye.lexicon
  import sockeye.model
  import sockeye.utils
label_desc: Use image node_id 4 for calling a global function with example usage: test_translator_input_with_source_prefix(sentence_id, sentence, factors, chunk_size, source_prefix, source_prefix_factors) without return types