Home / File/ test_beta_decorator.py — langchain Source File

test_beta_decorator.py — langchain Source File

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

File python CoreAbstractions RunnableInterface 6 imports 13 functions 4 classes

Entity Profile

Dependency Diagram

graph LR
  af0bb3cc_9182_00c9_fc61_39029170b37e["test_beta_decorator.py"]
  614e7b9f_ed51_0780_749c_ff40b74963fc["inspect"]
  af0bb3cc_9182_00c9_fc61_39029170b37e --> 614e7b9f_ed51_0780_749c_ff40b74963fc
  0c635125_6987_b8b3_7ff7_d60249aecde7["warnings"]
  af0bb3cc_9182_00c9_fc61_39029170b37e --> 0c635125_6987_b8b3_7ff7_d60249aecde7
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  af0bb3cc_9182_00c9_fc61_39029170b37e --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  120e2591_3e15_b895_72b6_cb26195e40a6["pytest"]
  af0bb3cc_9182_00c9_fc61_39029170b37e --> 120e2591_3e15_b895_72b6_cb26195e40a6
  6e58aaea_f08e_c099_3cc7_f9567bfb1ae7["pydantic"]
  af0bb3cc_9182_00c9_fc61_39029170b37e --> 6e58aaea_f08e_c099_3cc7_f9567bfb1ae7
  86bb3c96_f5a9_ad2a_8f3a_e3fd170519c9["langchain_core._api.beta_decorator"]
  af0bb3cc_9182_00c9_fc61_39029170b37e --> 86bb3c96_f5a9_ad2a_8f3a_e3fd170519c9
  style af0bb3cc_9182_00c9_fc61_39029170b37e 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.beta_decorator import beta, warn_beta


@pytest.mark.parametrize(
    ("kwargs", "expected_message"),
    [
        (
            {
                "name": "OldClass",
                "obj_type": "class",
            },
            "The class `OldClass` is in beta. It is actively being worked on, so the "
            "API may change.",
        ),
        (
            {
                "message": "This is a custom message",
                "name": "FunctionA",
                "obj_type": "",
                "addendum": "",
            },
            "This is a custom message",
        ),
        (
            {
                "message": "",
                "name": "SomeFunction",
                "obj_type": "",
                "addendum": "Please migrate your code.",
            },
            "`SomeFunction` is in beta. It is actively being worked on, "
            "so the API may "
            "change. Please migrate your code.",
        ),
    ],
)
def test_warn_beta(kwargs: dict[str, Any], expected_message: str) -> None:
    """Test warn beta."""
    with warnings.catch_warnings(record=True) as warning_list:
        warnings.simplefilter("always")

        warn_beta(**kwargs)

        assert len(warning_list) == 1
        warning = warning_list[0].message
        assert str(warning) == expected_message


@beta()
def beta_function() -> str:
    """Original doc."""
    return "This is a beta function."

// ... (319 more lines)

Subdomains

Dependencies

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

Frequently Asked Questions

What does test_beta_decorator.py do?
test_beta_decorator.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_beta_decorator.py?
test_beta_decorator.py defines 13 function(s): beta_async_function, beta_function, test_beta_async_function, test_beta_async_method, test_beta_classmethod, test_beta_function, test_beta_method, test_beta_method_pydantic, test_beta_property, test_beta_staticmethod, and 3 more.
What does test_beta_decorator.py depend on?
test_beta_decorator.py imports 6 module(s): inspect, langchain_core._api.beta_decorator, pydantic, pytest, typing, warnings.
Where is test_beta_decorator.py in the architecture?
test_beta_decorator.py is located at libs/core/tests/unit_tests/_api/test_beta_decorator.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