Home / Function/ test_solidity_code_splitter() — langchain Function Reference

test_solidity_code_splitter() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/text-splitters/tests/unit_tests/test_text_splitters.py lines 2338–2363

def test_solidity_code_splitter() -> None:
    splitter = RecursiveCharacterTextSplitter.from_language(
        Language.SOL, chunk_size=CHUNK_SIZE, chunk_overlap=0
    )
    code = """pragma solidity ^0.8.20;
  contract HelloWorld {
    function add(uint a, uint b) pure public returns(uint) {
      return  a + b;
    }
  }
  """
    chunks = splitter.split_text(code)
    assert chunks == [
        "pragma solidity",
        "^0.8.20;",
        "contract",
        "HelloWorld {",
        "function",
        "add(uint a,",
        "uint b) pure",
        "public",
        "returns(uint) {",
        "return  a",
        "+ b;",
        "}\n  }",
    ]

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free