Home / Function/ test_powershell_code_splitter_longer_code() — langchain Function Reference

test_powershell_code_splitter_longer_code() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/text-splitters/tests/unit_tests/test_text_splitters.py lines 3250–3278

def test_powershell_code_splitter_longer_code() -> None:
    splitter = RecursiveCharacterTextSplitter.from_language(
        Language.POWERSHELL, chunk_size=60, chunk_overlap=0
    )
    code = """
# Get a list of all processes and export to CSV
$processes = Get-Process
$processes | Export-Csv -Path "C:\\temp\\processes.csv" -NoTypeInformation

# Read the CSV file and display its content
$csvContent = Import-Csv -Path "C:\\temp\\processes.csv"
$csvContent | ForEach-Object {
    $_.ProcessName
}

# End of script
    """

    chunks = splitter.split_text(code)
    assert chunks == [
        "# Get a list of all processes and export to CSV",
        "$processes = Get-Process",
        '$processes | Export-Csv -Path "C:\\temp\\processes.csv"',
        "-NoTypeInformation",
        "# Read the CSV file and display its content",
        '$csvContent = Import-Csv -Path "C:\\temp\\processes.csv"',
        "$csvContent | ForEach-Object {\n    $_.ProcessName\n}",
        "# End of script",
    ]

Domain

Subdomains

Frequently Asked Questions

What does test_powershell_code_splitter_longer_code() do?
test_powershell_code_splitter_longer_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_longer_code() defined?
test_powershell_code_splitter_longer_code() is defined in libs/text-splitters/tests/unit_tests/test_text_splitters.py at line 3250.

Analyze Your Own Codebase

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

Try Supermodel Free