Home / Function/ test__split_list_works_correctly() — langchain Function Reference

test__split_list_works_correctly() — langchain Function Reference

Architecture documentation for the test__split_list_works_correctly() function in test_combine_documents.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  d8b7426d_a732_2de1_6a5a_9581cd788bc0["test__split_list_works_correctly()"]
  fdcbc2e2_7fde_290c_7006_d84e63536c57["test_combine_documents.py"]
  d8b7426d_a732_2de1_6a5a_9581cd788bc0 -->|defined in| fdcbc2e2_7fde_290c_7006_d84e63536c57
  style d8b7426d_a732_2de1_6a5a_9581cd788bc0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/chains/test_combine_documents.py lines 54–77

def test__split_list_works_correctly() -> None:
    """Test splitting works correctly."""
    docs = [
        Document(page_content="foo"),
        Document(page_content="bar"),
        Document(page_content="baz"),
        Document(page_content="foo" * 2),
        Document(page_content="bar"),
        Document(page_content="baz"),
    ]
    doc_list = split_list_of_docs(docs, _fake_docs_len_func, 10)
    expected_result = [
        # Test a group of three.
        [
            Document(page_content="foo"),
            Document(page_content="bar"),
            Document(page_content="baz"),
        ],
        # Test a group of two, where one is bigger.
        [Document(page_content="foo" * 2), Document(page_content="bar")],
        # Test no errors on last
        [Document(page_content="baz")],
    ]
    assert doc_list == expected_result

Domain

Subdomains

Frequently Asked Questions

What does test__split_list_works_correctly() do?
test__split_list_works_correctly() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/chains/test_combine_documents.py.
Where is test__split_list_works_correctly() defined?
test__split_list_works_correctly() is defined in libs/langchain/tests/unit_tests/chains/test_combine_documents.py at line 54.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free