Home / Function/ test_split_json_with_lists() — langchain Function Reference

test_split_json_with_lists() — langchain Function Reference

Architecture documentation for the test_split_json_with_lists() function in test_text_splitters.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  1fbd0a43_5577_bcfb_f5f3_8dd87a87e36d["test_split_json_with_lists()"]
  6d6b8ad4_1cfe_fbb0_e58e_76a50487c135["test_text_splitters.py"]
  1fbd0a43_5577_bcfb_f5f3_8dd87a87e36d -->|defined in| 6d6b8ad4_1cfe_fbb0_e58e_76a50487c135
  style 1fbd0a43_5577_bcfb_f5f3_8dd87a87e36d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/text-splitters/tests/unit_tests/test_text_splitters.py lines 3184–3204

def test_split_json_with_lists() -> None:
    """Test json text splitter with list conversion."""
    max_chunk = 800
    splitter = RecursiveJsonSplitter(max_chunk_size=max_chunk)

    def random_val() -> str:
        return "".join(random.choices(string.ascii_letters, k=random.randint(4, 12)))

    test_data: Any = {
        "val0": random_val(),
        "val1": {f"val1{i}": random_val() for i in range(100)},
    }
    test_data["val1"]["val16"] = {f"val16{i}": random_val() for i in range(100)}

    test_data_list: Any = {"testPreprocessing": [test_data]}

    # test text splitter
    texts = splitter.split_text(json_data=test_data)
    texts_list = splitter.split_text(json_data=test_data_list, convert_lists=True)

    assert len(texts_list) >= len(texts)

Domain

Subdomains

Frequently Asked Questions

What does test_split_json_with_lists() do?
test_split_json_with_lists() is a function in the langchain codebase, defined in libs/text-splitters/tests/unit_tests/test_text_splitters.py.
Where is test_split_json_with_lists() defined?
test_split_json_with_lists() is defined in libs/text-splitters/tests/unit_tests/test_text_splitters.py at line 3184.

Analyze Your Own Codebase

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

Try Supermodel Free