Home / Function/ test_python_text_splitter() — langchain Function Reference

test_python_text_splitter() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/text-splitters/tests/unit_tests/test_text_splitters.py lines 472–480

def test_python_text_splitter() -> None:
    splitter = PythonCodeTextSplitter(chunk_size=30, chunk_overlap=0)
    splits = splitter.split_text(FAKE_PYTHON_TEXT)
    split_0 = """class Foo:\n\n    def bar():"""
    split_1 = """def foo():"""
    split_2 = """def testing_func():"""
    split_3 = """def bar():"""
    expected_splits = [split_0, split_1, split_2, split_3]
    assert splits == expected_splits

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free