Home / Function/ test_allowed_prefixes() — langchain Function Reference

test_allowed_prefixes() — langchain Function Reference

Architecture documentation for the test_allowed_prefixes() function in test_anthropic_tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  ad7b811c_8e18_660c_351b_524e108f597a["test_allowed_prefixes()"]
  9599afe1_8f2e_3733_d25a_c88263c5beba["TestPathValidation"]
  ad7b811c_8e18_660c_351b_524e108f597a -->|defined in| 9599afe1_8f2e_3733_d25a_c88263c5beba
  style ad7b811c_8e18_660c_351b_524e108f597a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/tests/unit_tests/middleware/test_anthropic_tools.py lines 38–53

    def test_allowed_prefixes(self) -> None:
        """Test path prefix validation."""
        # Should pass
        assert (
            _validate_path("/workspace/file.txt", allowed_prefixes=["/workspace"])
            == "/workspace/file.txt"
        )

        # Should fail
        with pytest.raises(ValueError, match="Path must start with"):
            _validate_path("/etc/passwd", allowed_prefixes=["/workspace"])

        with pytest.raises(ValueError, match="Path must start with"):
            _validate_path(
                "/workspacemalicious/file.txt", allowed_prefixes=["/workspace/"]
            )

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free