@@ -268,10 +268,10 @@ def test_log_langfuse_v2_handles_null_usage_values(self):
268268 Test that _log_langfuse_v2 correctly handles None values in the usage object
269269 by converting them to 0, preventing validation errors.
270270 """
271- # Reset the mock to ensure clean state
272- self .mock_langfuse_client .reset_mock ()
273- self .mock_langfuse_trace .reset_mock ()
274- self .mock_langfuse_generation .reset_mock ()
271+ # Reset the mock to ensure clean state; clear side_effect so return_value takes effect
272+ self .mock_langfuse_client .reset_mock (side_effect = True )
273+ self .mock_langfuse_trace .reset_mock (side_effect = True )
274+ self .mock_langfuse_generation .reset_mock (side_effect = True )
275275
276276 # Re-setup the trace and generation chain with clean state
277277 self .mock_langfuse_generation .trace_id = "test-trace-id"
@@ -283,12 +283,14 @@ def test_log_langfuse_v2_handles_null_usage_values(self):
283283 # Ensure trace returns our mock
284284 self .mock_langfuse_client .trace .return_value = self .mock_langfuse_trace
285285 self .logger .Langfuse = self .mock_langfuse_client
286-
286+
287287 with patch (
288288 "litellm.integrations.langfuse.langfuse._add_prompt_to_generation_params" ,
289289 side_effect = lambda generation_params , ** kwargs : generation_params ,
290290 create = True ,
291- ) as mock_add_prompt_params :
291+ ) as mock_add_prompt_params , patch .object (
292+ self .logger , "_supports_prompt" , return_value = True
293+ ):
292294 # Create a mock response object with usage information containing None values
293295 response_obj = MagicMock ()
294296 response_obj .usage = MagicMock ()
0 commit comments