Home / Function/ test_grep_with_large_file_skipping() — langchain Function Reference

test_grep_with_large_file_skipping() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  4c1da238_8d9c_2a87_62f6_34c6c8c48a02["test_grep_with_large_file_skipping()"]
  4f81b5ee_096d_b9d6_73a1_343fbdcd7d93["TestGrepEdgeCases"]
  4c1da238_8d9c_2a87_62f6_34c6c8c48a02 -->|defined in| 4f81b5ee_096d_b9d6_73a1_343fbdcd7d93
  style 4c1da238_8d9c_2a87_62f6_34c6c8c48a02 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_file_search.py lines 387–405

    def test_grep_with_large_file_skipping(self, tmp_path: Path) -> None:
        """Test that grep skips files larger than max_file_size_mb."""
        # Create a file larger than 1MB
        large_content = "x" * (2 * 1024 * 1024)  # 2MB
        (tmp_path / "large.txt").write_text(large_content, encoding="utf-8")
        (tmp_path / "small.txt").write_text("x", encoding="utf-8")

        middleware = FilesystemFileSearchMiddleware(
            root_path=str(tmp_path),
            use_ripgrep=False,
            max_file_size_mb=1,  # 1MB limit
        )

        assert isinstance(middleware.grep_search, StructuredTool)
        assert middleware.grep_search.func is not None
        result = middleware.grep_search.func(pattern="x")

        # Large file should be skipped
        assert "/small.txt" in result

Domain

Subdomains

Frequently Asked Questions

What does test_grep_with_large_file_skipping() do?
test_grep_with_large_file_skipping() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_file_search.py.
Where is test_grep_with_large_file_skipping() defined?
test_grep_with_large_file_skipping() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_file_search.py at line 387.

Analyze Your Own Codebase

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

Try Supermodel Free