code: def test_translate_by_stdin_chunk2():
      mock_output_handler = unittest.mock.Mock(
          spec=sockeye.output_handler.OutputHandler
      )
      mock_translator = unittest.mock.Mock(
          spec=sockeye.inference.Translator
      )
      mock_translator.translate.return_value = ["", ""]
      mock_translator.num_source_factors = 1
      mock_translator.max_batch_size = 1
      mock_translator.nbest_size = 1
      sockeye.translate.read_and_translate(
          translator=mock_translator,
          output_handler=mock_output_handler,
          chunk_size=2,
      )
  
      # Ensure translate gets called once.  Input here will be a dummy mocked result, so we'll ignore it.
      assert mock_translator.translate.call_count == 1
  
file_path: sockeye/test/unit/test_translate.py
imports: import io
  import os
  import unittest
  import unittest.mock
  from tempfile import TemporaryDirectory
  import sockeye.constants
  import sockeye.inference
  import sockeye.output_handler
  import sockeye.translate
label_desc: Use image node_id 3 for calling a global function with example usage: test_translate_by_stdin_chunk2() without return types