test_guard_import() — langchain Function Reference
Architecture documentation for the test_guard_import() function in test_utils.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 75315111_415d_9bc1_f39b_8bba82cf25fd["test_guard_import()"] 76328b48_c466_d255_3e8f_a315858c4c02["test_utils.py"] 75315111_415d_9bc1_f39b_8bba82cf25fd -->|defined in| 76328b48_c466_d255_3e8f_a315858c4c02 style 75315111_415d_9bc1_f39b_8bba82cf25fd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/utils/test_utils.py lines 174–188
def test_guard_import(
module_name: str, pip_name: str | None, package: str | None, expected: Any
) -> None:
if package is None and pip_name is None:
ret = guard_import(module_name)
elif package is None and pip_name is not None:
ret = guard_import(module_name, pip_name=pip_name)
elif package is not None and pip_name is None:
ret = guard_import(module_name, package=package)
elif package is not None and pip_name is not None:
ret = guard_import(module_name, pip_name=pip_name, package=package)
else:
msg = "Invalid test case"
raise ValueError(msg)
assert ret == expected
Domain
Subdomains
Source
Frequently Asked Questions
What does test_guard_import() do?
test_guard_import() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/utils/test_utils.py.
Where is test_guard_import() defined?
test_guard_import() is defined in libs/core/tests/unit_tests/utils/test_utils.py at line 174.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free