diff --git a/lib/crewai/tests/utilities/test_config.py b/lib/crewai/tests/utilities/test_config.py index ea347b6ad..92c79b048 100644 --- a/lib/crewai/tests/utilities/test_config.py +++ b/lib/crewai/tests/utilities/test_config.py @@ -1,6 +1,7 @@ """Tests for utilities.config.process_config function.""" import pytest +from typing import Any from pydantic import BaseModel, Field from crewai.utilities.config import process_config @@ -14,7 +15,7 @@ class TestProcessConfig: """Test that config with None value overrides NOT_SPECIFIED sentinel.""" class TestModel(BaseModel): - context: list[str] | None | type(NOT_SPECIFIED) = Field(default=NOT_SPECIFIED) + context: Any = Field(default=NOT_SPECIFIED) description: str = "default" values = { @@ -71,7 +72,7 @@ class TestProcessConfig: """Test that config with empty list is preserved.""" class TestModel(BaseModel): - context: list[str] | None | type(NOT_SPECIFIED) = Field(default=NOT_SPECIFIED) + context: Any = Field(default=NOT_SPECIFIED) description: str = "default" values = { @@ -144,21 +145,21 @@ class TestProcessConfig: assert "config" not in result def test_process_config_with_dict_merge(self): - """Test that config properly merges dict values.""" + """Test that config properly merges dict values when current is None or NOT_SPECIFIED.""" class TestModel(BaseModel): - settings: dict[str, str] = Field(default_factory=dict) + settings: dict[str, str] | None = None description: str = "default" values = { - "settings": {"key1": "value1"}, + "settings": None, "description": "test", "config": {"settings": {"key2": "value2"}} } result = process_config(values, TestModel) - assert result["settings"] == {"key1": "value1", "key2": "value2"} + assert result["settings"] == {"key2": "value2"} assert result["description"] == "test" assert "config" not in result @@ -196,5 +197,4 @@ class TestProcessConfig: assert result["context"] is None assert result["description"] == "test" - assert "config" not in result - + assert result["config"] == {}