Home / Function/ test_powershell_code_splitter_short_code() — langchain Function Reference

test_powershell_code_splitter_short_code() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/text-splitters/tests/unit_tests/test_text_splitters.py lines 3228–3247

def test_powershell_code_splitter_short_code() -> None:
    splitter = RecursiveCharacterTextSplitter.from_language(
        Language.POWERSHELL, chunk_size=60, chunk_overlap=0
    )
    code = """
# Check if a file exists
$filePath = "C:\\temp\\file.txt"
if (Test-Path $filePath) {
    # File exists
} else {
    # File does not exist
}
    """

    chunks = splitter.split_text(code)
    assert chunks == [
        '# Check if a file exists\n$filePath = "C:\\temp\\file.txt"',
        "if (Test-Path $filePath) {\n    # File exists\n} else {",
        "# File does not exist\n}",
    ]

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free