Skip to content

The agent engineering platform.

test(core): enhance stringify_value test coverage for nested structures (#33099)

Ali Ismail729bfe836984
diff --git a/libs/core/tests/unit_tests/utils/test_strings.py b/libs/core/tests/unit_tests/utils/test_strings.py
index 85c328a475..2cf8aa14b4 100644
--- a/libs/core/tests/unit_tests/utils/test_strings.py
+++ b/libs/core/tests/unit_tests/utils/test_strings.py
@@ -47,3 +47,35 @@ def test_existing_string_functions() -> None:
result = stringify_dict(data)
assert "key: value" in result
assert "number: 123" in result
+
+
+def test_stringify_value_nested_structures() -> None:
+ """Test stringifying nested structures."""
+ # Test nested dict in list
+ nested_data = {
+ "users": [
+ {"name": "Alice", "age": 25},
+ {"name": "Bob", "age": 30},
+ ],
+ "metadata": {"total_users": 2, "active": True},
+ }
+
+ result = stringify_value(nested_data)
+
+ # Shoudl contain all the nested values
+ assert "users:" in result
+ assert "name: Alice" in result
+ assert "name: Bob" in result
+ assert "metadata:" in result
+ assert "total_users: 2" in result
+ assert "active: True" in result
+
+ # Test list of mixed types
+ mixed_list = ["string", 42, {"key": "value"}, ["nested", "list"]]
+ result = stringify_value(mixed_list)
+
+ assert "string" in result
+ assert "42" in result
+ assert "key: value" in result
+ assert "nested" in result
+ assert "list" in result