test_no_overrides_DO_NOT_OVERRIDE() — langchain Function Reference
Architecture documentation for the test_no_overrides_DO_NOT_OVERRIDE() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 31fc1f55_7fbf_7f0d_7298_aaba0528ac1a["test_no_overrides_DO_NOT_OVERRIDE()"] 16d6f571_58aa_6b96_bef7_b3936b2b5e8e["BaseStandardTests"] 31fc1f55_7fbf_7f0d_7298_aaba0528ac1a -->|defined in| 16d6f571_58aa_6b96_bef7_b3936b2b5e8e style 31fc1f55_7fbf_7f0d_7298_aaba0528ac1a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/standard-tests/langchain_tests/base.py lines 7–62
def test_no_overrides_DO_NOT_OVERRIDE(self) -> None: # noqa: N802
"""Test that no standard tests are overridden."""
# Find path to standard test implementations
comparison_class = None
def explore_bases(cls: type) -> None:
nonlocal comparison_class
for base in cls.__bases__:
if base.__module__.startswith("langchain_tests."):
if comparison_class is None:
comparison_class = base
else:
msg = (
"Multiple standard test base classes found: "
f"{comparison_class}, {base}"
)
raise ValueError(msg)
else:
explore_bases(base)
explore_bases(self.__class__)
assert comparison_class is not None, "No standard test base class found."
print(f"Comparing {self.__class__} to {comparison_class}") # noqa: T201
running_tests = {method for method in dir(self) if method.startswith("test_")}
base_tests = {
method for method in dir(comparison_class) if method.startswith("test_")
}
deleted_tests = base_tests - running_tests
assert not deleted_tests, f"Standard tests deleted: {deleted_tests}"
overridden_tests = [
method
for method in base_tests
if getattr(self.__class__, method) is not getattr(comparison_class, method)
]
def is_xfail(method: str) -> bool:
m = getattr(self.__class__, method)
if not hasattr(m, "pytestmark"):
return False
marks = m.pytestmark
return any(
mark.name == "xfail" and mark.kwargs.get("reason") for mark in marks
)
overridden_not_xfail = [
method for method in overridden_tests if not is_xfail(method)
]
assert not overridden_not_xfail, (
"Standard tests overridden without "
f'@pytest.mark.xfail(reason="..."): {overridden_not_xfail}\n'
"Note: reason is required to explain why the standard test has an expected "
"failure."
)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_no_overrides_DO_NOT_OVERRIDE() do?
test_no_overrides_DO_NOT_OVERRIDE() is a function in the langchain codebase, defined in libs/standard-tests/langchain_tests/base.py.
Where is test_no_overrides_DO_NOT_OVERRIDE() defined?
test_no_overrides_DO_NOT_OVERRIDE() is defined in libs/standard-tests/langchain_tests/base.py at line 7.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free