def test_partition_records_offset(mocker):
    """Test that compressed messagesets are handle correctly
    when fetch offset is in the middle of the message list
    """
    batch_start = 120
    batch_end = 130
    fetch_offset = 123
    tp = TopicPartition('foo', 0)
    messages = [(None, b'msg', None) for i in range(batch_start, batch_end)]
    memory_records = MemoryRecords(_build_record_batch(messages, offset=batch_start))
    records = Fetcher.PartitionRecords(fetch_offset, tp, memory_records)
    assert records
    assert records.next_fetch_offset == fetch_offset
    msgs = records.take(1)
    assert msgs[0].offset == fetch_offset
    assert records.next_fetch_offset == fetch_offset + 1
    msgs = records.take(2)
    assert len(msgs) == 2
    assert records
    assert records.next_fetch_offset == fetch_offset + 3
    records.drain()
    assert not records
Test that compressed messagesets are handle correctly
    when fetch offset is in the middle of the message list
    
test/test_fetcher.py