code: def test_memory_records_corrupt():
      records = MemoryRecords(b"")
      assert records.size_in_bytes() == 0
      assert records.valid_bytes() == 0
      assert records.has_next() is False
  
      records = MemoryRecords(b"\x00\x00\x00")
      assert records.size_in_bytes() == 3
      assert records.valid_bytes() == 0
      assert records.has_next() is False
  
      records = MemoryRecords(
          b"\x00\x00\x00\x00\x00\x00\x00\x03"  # Offset=3
          b"\x00\x00\x00\x03"  # Length=3
          b"\xfe\xb0\x1d",  # Some random bytes
      )
      with pytest.raises(CorruptRecordException):
          records.next_batch()
  
file_path: kafka-python/test/record/test_records.py
imports: from __future__ import unicode_literals
  import pytest
  from kafka.record import MemoryRecords, MemoryRecordsBuilder
  from kafka.errors import CorruptRecordException
label_desc: Use image node_id 4 for calling a global function with example usage: test_memory_records_corrupt() without return types