code: def test_memory_records_v2():
      data_bytes = b"".join(record_batch_data_v2) + b"\x00" * 4
      records = MemoryRecords(data_bytes)
  
      assert records.size_in_bytes() == 303
      assert records.valid_bytes() == 299
  
      assert records.has_next() is True
      batch = records.next_batch()
      recs = list(batch)
      assert len(recs) == 1
      assert recs[0].value == b"123"
      assert recs[0].key is None
      assert recs[0].timestamp == 1503229838908
      assert recs[0].timestamp_type == 0
      assert recs[0].checksum is None
      assert recs[0].headers == []
  
      assert records.next_batch() is not None
      assert records.next_batch() is not None
  
      batch = records.next_batch()
      recs = list(batch)
      assert len(recs) == 1
      assert recs[0].value == b"hdr"
      assert recs[0].headers == [("hkey", b"hval")]
  
      assert records.has_next() is False
      assert records.next_batch() is None
      assert records.next_batch() is None
  
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 1 for calling a global function with example usage: test_memory_records_v2() without return types