Home / Function/ test_grep_default_backend() — langchain Function Reference

test_grep_default_backend() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  75b05469_9f99_29a8_b477_f79561c24982["test_grep_default_backend()"]
  d14e334f_5741_3f09_dcc5_cbb464236d19["TestSearchWithDifferentBackends"]
  75b05469_9f99_29a8_b477_f79561c24982 -->|defined in| d14e334f_5741_3f09_dcc5_cbb464236d19
  style 75b05469_9f99_29a8_b477_f79561c24982 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/tests/unit_tests/middleware/test_file_search.py lines 482–515

    def test_grep_default_backend(self) -> None:
        """Test that grep searches the default backend (text_editor_files)."""
        middleware = StateFileSearchMiddleware()

        state: AnthropicToolsState = {
            "messages": [],
            "text_editor_files": {
                "/src/main.py": {
                    "content": ["TODO: implement"],
                    "created_at": "2025-01-01T00:00:00",
                    "modified_at": "2025-01-01T00:00:00",
                },
            },
            "memory_files": {
                "/memories/tasks.txt": {
                    "content": ["TODO: review"],
                    "created_at": "2025-01-01T00:00:00",
                    "modified_at": "2025-01-01T00:00:00",
                },
            },
        }

        result = middleware._handle_grep_search(
            pattern=r"TODO",
            path="/",
            include=None,
            output_mode="files_with_matches",
            state=state,
        )

        assert isinstance(result, str)
        assert "/src/main.py" in result
        # Should NOT find memory_files since default backend is text_editor_files
        assert "/memories/tasks.txt" not in result

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free