Home / File/ test_deprecation.py — langchain Source File

test_deprecation.py — langchain Source File

Architecture documentation for test_deprecation.py, a python file in the langchain codebase. 6 imports, 0 dependents.

File python CoreAbstractions RunnableInterface 6 imports 24 functions 7 classes

Entity Profile

Dependency Diagram

graph LR
  07400ddb_6f57_2ca9_d2d9_e7c7fd98cfc1["test_deprecation.py"]
  614e7b9f_ed51_0780_749c_ff40b74963fc["inspect"]
  07400ddb_6f57_2ca9_d2d9_e7c7fd98cfc1 --> 614e7b9f_ed51_0780_749c_ff40b74963fc
  0c635125_6987_b8b3_7ff7_d60249aecde7["warnings"]
  07400ddb_6f57_2ca9_d2d9_e7c7fd98cfc1 --> 0c635125_6987_b8b3_7ff7_d60249aecde7
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  07400ddb_6f57_2ca9_d2d9_e7c7fd98cfc1 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  120e2591_3e15_b895_72b6_cb26195e40a6["pytest"]
  07400ddb_6f57_2ca9_d2d9_e7c7fd98cfc1 --> 120e2591_3e15_b895_72b6_cb26195e40a6
  6e58aaea_f08e_c099_3cc7_f9567bfb1ae7["pydantic"]
  07400ddb_6f57_2ca9_d2d9_e7c7fd98cfc1 --> 6e58aaea_f08e_c099_3cc7_f9567bfb1ae7
  2d1edd36_20be_d887_f834_7b58c1b5a50f["langchain_core._api.deprecation"]
  07400ddb_6f57_2ca9_d2d9_e7c7fd98cfc1 --> 2d1edd36_20be_d887_f834_7b58c1b5a50f
  style 07400ddb_6f57_2ca9_d2d9_e7c7fd98cfc1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import inspect
import warnings
from typing import Any

import pytest
from pydantic import BaseModel

from langchain_core._api.deprecation import (
    deprecated,
    rename_parameter,
    warn_deprecated,
)


@pytest.mark.parametrize(
    ("kwargs", "expected_message"),
    [
        (
            {
                "since": "1.0.0",
                "name": "OldClass",
                "alternative": "NewClass",
                "pending": True,
                "obj_type": "class",
            },
            "The class `OldClass` will be deprecated in a future version. Use NewClass "
            "instead.",
        ),
        (
            {
                "since": "2.0.0",
                "message": "This is a custom message",
                "name": "FunctionA",
                "alternative": "",
                "pending": True,
                "obj_type": "",
                "addendum": "",
                "removal": "",
            },
            "This is a custom message",
        ),
        (
            {
                "since": "1.5.0",
                "message": "",
                "name": "SomeFunction",
                "alternative": "",
                "pending": False,
                "obj_type": "",
                "addendum": "Please migrate your code.",
                "removal": "2.5.0",
            },
            "`SomeFunction` was deprecated in LangChain 1.5.0 and will be "
            "removed in 2.5.0 Please migrate your code.",
        ),
    ],
)
def test_warn_deprecated(kwargs: dict[str, Any], expected_message: str) -> None:
    """Test warn deprecated."""
    with warnings.catch_warnings(record=True) as warning_list:
// ... (521 more lines)

Subdomains

Dependencies

  • inspect
  • langchain_core._api.deprecation
  • pydantic
  • pytest
  • typing
  • warnings

Frequently Asked Questions

What does test_deprecation.py do?
test_deprecation.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in test_deprecation.py?
test_deprecation.py defines 24 function(s): deprecated_async_function, deprecated_function, test_deprecated_async_function, test_deprecated_async_method, test_deprecated_class_has_pep702_attribute, test_deprecated_class_without_alternative_has_pep702_attribute, test_deprecated_classmethod, test_deprecated_function, test_deprecated_function_has_pep702_attribute, test_deprecated_function_with_alternative_import_has_pep702_attribute, and 14 more.
What does test_deprecation.py depend on?
test_deprecation.py imports 6 module(s): inspect, langchain_core._api.deprecation, pydantic, pytest, typing, warnings.
Where is test_deprecation.py in the architecture?
test_deprecation.py is located at libs/core/tests/unit_tests/_api/test_deprecation.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/core/tests/unit_tests/_api).

Analyze Your Own Codebase

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

Try Supermodel Free