Home / Function/ test_init_from_env() — langchain Function Reference

test_init_from_env() — langchain Function Reference

Architecture documentation for the test_init_from_env() function in tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  810f82d8_ed1b_fd08_0b30_dcda86b47f8c["test_init_from_env()"]
  5b8c9c93_fb5c_4750_c17c_9d41c1862020["ToolsUnitTests"]
  810f82d8_ed1b_fd08_0b30_dcda86b47f8c -->|defined in| 5b8c9c93_fb5c_4750_c17c_9d41c1862020
  f015ba66_2cd9_9ade_91c9_9689d4faf9d7["tool_constructor()"]
  810f82d8_ed1b_fd08_0b30_dcda86b47f8c -->|calls| f015ba66_2cd9_9ade_91c9_9689d4faf9d7
  style 810f82d8_ed1b_fd08_0b30_dcda86b47f8c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/standard-tests/langchain_tests/unit_tests/tools.py lines 85–96

    def test_init_from_env(self) -> None:
        """Test that the tool can be initialized from environment variables."""
        env_params, tools_params, expected_attrs = self.init_from_env_params
        if env_params:
            with mock.patch.dict(os.environ, env_params):
                tool = self.tool_constructor(**tools_params)  # type: ignore[operator]
            assert tool is not None
            for k, expected in expected_attrs.items():
                actual = getattr(tool, k)
                if isinstance(actual, SecretStr):
                    actual = actual.get_secret_value()
                assert actual == expected

Domain

Subdomains

Frequently Asked Questions

What does test_init_from_env() do?
test_init_from_env() is a function in the langchain codebase, defined in libs/standard-tests/langchain_tests/unit_tests/tools.py.
Where is test_init_from_env() defined?
test_init_from_env() is defined in libs/standard-tests/langchain_tests/unit_tests/tools.py at line 85.
What does test_init_from_env() call?
test_init_from_env() calls 1 function(s): tool_constructor.

Analyze Your Own Codebase

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

Try Supermodel Free