code: def test_multi_record_strategy_with_large_records():
      splitter = Mock()
      mb = 1024 * 1024
  
      multi_record = sagemaker.local.data.MultiRecordStrategy(splitter)
      # we will construct several large records and we expect them to be merged into <1MB ones
      buffer = ""
      while sys.getsizeof(buffer) < 0.5 * mb:
          buffer += "1" * 100
  
      # buffer should be aprox 0.5 MB. We will make the data total 10 MB made out of 0.5mb records
      # with a max_payload size of 1MB the expectation is to have ~10 output records.
  
      data = [buffer for _ in range(10)]
      splitter.split.return_value = data
  
      batch_records = [r for r in multi_record.pad("some_file", 1)]
      # check with 11 because there may be a bit of leftover.
      assert len(batch_records) <= 11
  
imports: from __future__ import absolute_import
  import sys
  import pytest
  from mock import patch, Mock
  import sagemaker.amazon
  import sagemaker.local.data
label_desc: Use image node_id 18 for calling a global function with example usage: test_multi_record_strategy_with_large_records() without return types