Home / Function/ test_whole_class_deprecation() — langchain Function Reference

test_whole_class_deprecation() — langchain Function Reference

Architecture documentation for the test_whole_class_deprecation() function in test_deprecation.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  41c7c1a7_396b_64b5_2e9e_7eb7f9569b69["test_whole_class_deprecation()"]
  07400ddb_6f57_2ca9_d2d9_e7c7fd98cfc1["test_deprecation.py"]
  41c7c1a7_396b_64b5_2e9e_7eb7f9569b69 -->|defined in| 07400ddb_6f57_2ca9_d2d9_e7c7fd98cfc1
  751ec235_2cab_e87f_bb57_2a3fa91d5d9d["deprecated_method()"]
  41c7c1a7_396b_64b5_2e9e_7eb7f9569b69 -->|calls| 751ec235_2cab_e87f_bb57_2a3fa91d5d9d
  style 41c7c1a7_396b_64b5_2e9e_7eb7f9569b69 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/_api/test_deprecation.py lines 260–295

def test_whole_class_deprecation() -> None:
    """Test whole class deprecation."""

    # Test whole class deprecation
    @deprecated(since="2.0.0", removal="3.0.0")
    class DeprecatedClass:
        def __init__(self) -> None:
            """Original doc."""

        @deprecated(since="2.0.0", removal="3.0.0")
        def deprecated_method(self) -> str:
            """Original doc."""
            return "This is a deprecated method."

    with warnings.catch_warnings(record=True) as warning_list:
        warnings.simplefilter("always")

        obj = DeprecatedClass()
        assert obj.deprecated_method() == "This is a deprecated method."

        assert len(warning_list) == 2
        warning = warning_list[0].message
        assert str(warning) == (
            "The class `test_whole_class_deprecation.<locals>.DeprecatedClass` was "
            "deprecated in tests 2.0.0 and will be removed in 3.0.0"
        )

        warning = warning_list[1].message
        assert str(warning) == (
            "The method `test_whole_class_deprecation.<locals>.DeprecatedClass."
            "deprecated_method` was deprecated in "
            "tests 2.0.0 and will be removed in 3.0.0"
        )
        # [*Deprecated*] should be inserted only once:
        if obj.__doc__ is not None:
            assert obj.__doc__.count("!!! deprecated") == 1

Subdomains

Frequently Asked Questions

What does test_whole_class_deprecation() do?
test_whole_class_deprecation() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/_api/test_deprecation.py.
Where is test_whole_class_deprecation() defined?
test_whole_class_deprecation() is defined in libs/core/tests/unit_tests/_api/test_deprecation.py at line 260.
What does test_whole_class_deprecation() call?
test_whole_class_deprecation() calls 1 function(s): deprecated_method.

Analyze Your Own Codebase

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

Try Supermodel Free