Home / Function/ test_shell_tool_input_validation() — langchain Function Reference

test_shell_tool_input_validation() — langchain Function Reference

Architecture documentation for the test_shell_tool_input_validation() function in test_shell_tool.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  9700a6fb_2ae8_b4fb_247f_c75f0a0f830e["test_shell_tool_input_validation()"]
  f21fd460_1d0c_cb92_cfa1_eae0890e2f58["test_shell_tool.py"]
  9700a6fb_2ae8_b4fb_247f_c75f0a0f830e -->|defined in| f21fd460_1d0c_cb92_cfa1_eae0890e2f58
  style 9700a6fb_2ae8_b4fb_247f_c75f0a0f830e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_shell_tool.py lines 177–195

def test_shell_tool_input_validation() -> None:
    """Test _ShellToolInput validation rules."""
    # Both command and restart not allowed
    with pytest.raises(ValueError, match="only one"):
        _ShellToolInput(command="ls", restart=True)

    # Neither command nor restart provided
    with pytest.raises(ValueError, match="requires either"):
        _ShellToolInput()

    # Valid: command only
    valid_cmd = _ShellToolInput(command="ls")
    assert valid_cmd.command == "ls"
    assert not valid_cmd.restart

    # Valid: restart only
    valid_restart = _ShellToolInput(restart=True)
    assert valid_restart.restart is True
    assert valid_restart.command is None

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free