Skip to content

Commit

Permalink
Add method tool classmethod test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanglide committed Dec 9, 2024
1 parent ee66099 commit 691f01b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions libs/core/tests/unit_tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2216,3 +2216,18 @@ def foo(cls, a: int, b: int) -> int:
return a + b + cls.c

assert A.foo.invoke({"a": 1, "b": 2}) == 8


def test_method_tool_classmethod_args() -> None:
"""Test that a classmethod tool's args do not include cls."""

class A:
c = 5

@classmethod
@tool
def foo(cls, a: int, b: int) -> int:
"""Add two numbers to c."""
return a + b + cls.c

assert "cls" not in A.foo.args

0 comments on commit 691f01b

Please sign in to comment.