Home / Function/ test_deprecated_property_has_pep702_attribute() — langchain Function Reference

test_deprecated_property_has_pep702_attribute() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  78ae3fb4_9913_d802_6be4_4a4bd07befb5["test_deprecated_property_has_pep702_attribute()"]
  07400ddb_6f57_2ca9_d2d9_e7c7fd98cfc1["test_deprecation.py"]
  78ae3fb4_9913_d802_6be4_4a4bd07befb5 -->|defined in| 07400ddb_6f57_2ca9_d2d9_e7c7fd98cfc1
  5fc74b51_c751_a3f0_c846_878f58f0ffc7["old_property()"]
  78ae3fb4_9913_d802_6be4_4a4bd07befb5 -->|calls| 5fc74b51_c751_a3f0_c846_878f58f0ffc7
  style 78ae3fb4_9913_d802_6be4_4a4bd07befb5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/_api/test_deprecation.py lines 563–580

def test_deprecated_property_has_pep702_attribute() -> None:
    """Test that deprecated properties have `__deprecated__` attribute (PEP 702).

    Note: When using @property over @deprecated (which is what works in practice),
    the `__deprecated__` attribute is set on the property's underlying `fget` function.
    """

    class MyClass:
        @property
        @deprecated(since="2.0.0", removal="3.0.0", alternative="new_property")
        def old_property(self) -> str:
            """Original doc."""
            return "old"

    prop = MyClass.__dict__["old_property"]
    # The __deprecated__ attribute is on the underlying fget function
    assert hasattr(prop.fget, "__deprecated__")
    assert prop.fget.__deprecated__ == "Use new_property instead."

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free