async def test_content_blocks_memory_block(memory_with_blocks):
    """Test content blocks memory block integration."""
    # Get the memory block content
    content = await memory_with_blocks._get_memory_blocks_content([])

    # Verify content blocks block content
    assert "content_blocks" in content
    assert len(content["content_blocks"]) == 2
    assert content["content_blocks"][0].text == "Text block 1"
    assert content["content_blocks"][1].text == "Text block 2"

    # Format content for insertion
    formatted_blocks, _ = await memory_with_blocks._format_memory_blocks(
        {"content_blocks": content["content_blocks"]}
    )

    # Check formatting
    assert len(formatted_blocks) == 1
    block_name, content = formatted_blocks[0]

    assert block_name == "content_blocks"
    assert len(content) == 2
    assert content[0].text == "Text block 1"
    assert content[1].text == "Text block 2"
Test content blocks memory block integration.
llama-index-core/tests/memory/test_memory_blocks_base.py