From a4d6d0ee9e91671b3cffdb0229346a3fc5489678 Mon Sep 17 00:00:00 2001 From: Greyson LaLonde Date: Sat, 23 May 2026 13:10:52 -0700 Subject: [PATCH] test(callback): assert None for lambdas and closures --- lib/crewai/tests/test_callback.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/crewai/tests/test_callback.py b/lib/crewai/tests/test_callback.py index 417c74d98..43d2ed0f7 100644 --- a/lib/crewai/tests/test_callback.py +++ b/lib/crewai/tests/test_callback.py @@ -4,6 +4,7 @@ from __future__ import annotations import functools import os +from collections.abc import Callable from typing import Any import pytest from pydantic import BaseModel, ValidationError @@ -93,10 +94,18 @@ class TestCallableToString: result = callable_to_string(print) assert result == "builtins.print" - def test_lambda_produces_locals_path(self) -> None: + def test_lambda_returns_none(self) -> None: fn = lambda: None # noqa: E731 - result = callable_to_string(fn) - assert "" in result + assert callable_to_string(fn) is None + + def test_closure_returns_none(self) -> None: + def outer() -> Callable[[], None]: + def inner() -> None: + return None + + return inner + + assert callable_to_string(outer()) is None def test_missing_qualname_raises(self) -> None: obj = type("NoQual", (), {"__module__": "test"})()