Home / Function/ test_rename_parameter_method() — langchain Function Reference

test_rename_parameter_method() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  dd411698_24c1_043d_b57c_b2892e38970d["test_rename_parameter_method()"]
  07400ddb_6f57_2ca9_d2d9_e7c7fd98cfc1["test_deprecation.py"]
  dd411698_24c1_043d_b57c_b2892e38970d -->|defined in| 07400ddb_6f57_2ca9_d2d9_e7c7fd98cfc1
  style dd411698_24c1_043d_b57c_b2892e38970d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/_api/test_deprecation.py lines 466–495

def test_rename_parameter_method() -> None:
    """Test that it works for a method."""

    class Foo:
        @rename_parameter(
            since="2.0.0", removal="3.0.0", old="old_name", new="new_name"
        )
        def a(self, new_name: str) -> str:
            return new_name

    foo = Foo()

    with warnings.catch_warnings(record=True) as warning_list:
        warnings.simplefilter("always")
        assert foo.a(old_name="hello") == "hello"  # type: ignore[call-arg]
        assert len(warning_list) == 1
        assert str(warning_list[0].message) == (
            "The parameter `old_name` of `a` was deprecated in 2.0.0 and will be "
            "removed "
            "in 3.0.0 Use `new_name` instead."
        )

        assert foo.a(new_name="hello") == "hello"
        assert foo.a("hello") == "hello"

        with pytest.raises(TypeError):
            foo.a(meow="hello")  # type: ignore[call-arg]

        with pytest.raises(TypeError):
            assert foo.a("hello", old_name="hello")  # type: ignore[call-arg]

Subdomains

Frequently Asked Questions

What does test_rename_parameter_method() do?
test_rename_parameter_method() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/_api/test_deprecation.py.
Where is test_rename_parameter_method() defined?
test_rename_parameter_method() is defined in libs/core/tests/unit_tests/_api/test_deprecation.py at line 466.

Analyze Your Own Codebase

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

Try Supermodel Free