Home / Function/ test_grep_content_mode() — langchain Function Reference

test_grep_content_mode() — langchain Function Reference

Architecture documentation for the test_grep_content_mode() function in test_file_search.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  8336df0b_9425_6503_d52e_0d3a5fa448e6["test_grep_content_mode()"]
  cc6c9310_5391_59ed_60fd_270a44975195["TestFilesystemGrepSearch"]
  8336df0b_9425_6503_d52e_0d3a5fa448e6 -->|defined in| cc6c9310_5391_59ed_60fd_270a44975195
  style 8336df0b_9425_6503_d52e_0d3a5fa448e6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/tests/unit_tests/middleware/test_file_search.py lines 243–270

    def test_grep_content_mode(self) -> None:
        """Test grep with content output mode."""
        middleware = StateFileSearchMiddleware()

        state: AnthropicToolsState = {
            "messages": [],
            "text_editor_files": {
                "/src/main.py": {
                    "content": ["def foo():", "    pass", "def bar():"],
                    "created_at": "2025-01-01T00:00:00",
                    "modified_at": "2025-01-01T00:00:00",
                },
            },
        }

        result = middleware._handle_grep_search(
            pattern=r"def \w+\(\):",
            path="/",
            include=None,
            output_mode="content",
            state=state,
        )

        assert isinstance(result, str)
        lines = result.split("\n")
        assert len(lines) == 2
        assert lines[0] == "/src/main.py:1:def foo():"
        assert lines[1] == "/src/main.py:3:def bar():"

Domain

Subdomains

Frequently Asked Questions

What does test_grep_content_mode() do?
test_grep_content_mode() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/unit_tests/middleware/test_file_search.py.
Where is test_grep_content_mode() defined?
test_grep_content_mode() is defined in libs/partners/anthropic/tests/unit_tests/middleware/test_file_search.py at line 243.

Analyze Your Own Codebase

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

Try Supermodel Free