test_import_all() — langchain Function Reference
Architecture documentation for the test_import_all() function in test_imports.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD e7728bdc_cf3c_60c7_de48_36415e951637["test_import_all()"] 1a4ae21b_d553_aa88_bac6_fd6971a4e02d["test_imports.py"] e7728bdc_cf3c_60c7_de48_36415e951637 -->|defined in| 1a4ae21b_d553_aa88_bac6_fd6971a4e02d style e7728bdc_cf3c_60c7_de48_36415e951637 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/tests/unit_tests/test_imports.py lines 14–46
def test_import_all() -> None:
"""Generate the public API for this package."""
with warnings.catch_warnings():
warnings.filterwarnings(action="ignore", category=UserWarning)
library_code = PKG_ROOT / "langchain_classic"
for path in library_code.rglob("*.py"):
# Calculate the relative path to the module
module_name = (
path.relative_to(PKG_ROOT).with_suffix("").as_posix().replace("/", ".")
)
if module_name.endswith("__init__"):
# Without init
module_name = module_name.rsplit(".", 1)[0]
mod = importlib.import_module(module_name)
all_attrs = getattr(mod, "__all__", [])
for name in all_attrs:
# Attempt to import the name from the module
try:
obj = getattr(mod, name)
assert obj is not None
except ModuleNotFoundError as e:
# If the module is not installed, we suppress the error
if (
"Module langchain_community" in str(e)
and COMMUNITY_NOT_INSTALLED
):
pass
except Exception as e:
msg = f"Could not import {module_name}.{name}"
raise AssertionError(msg) from e
Domain
Subdomains
Source
Frequently Asked Questions
What does test_import_all() do?
test_import_all() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/test_imports.py.
Where is test_import_all() defined?
test_import_all() is defined in libs/langchain/tests/unit_tests/test_imports.py at line 14.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free