11"""Tests for the CLI helper classes."""
22
3+ import json
34from unittest .mock import MagicMock , patch
45
56from rich .console import Console
@@ -218,10 +219,11 @@ def test_output_json_ready_status(self, mock_echo):
218219 formatter .output_json ()
219220
220221 mock_echo .assert_called_once ()
221- # Just check that it was called with a dict
222+ # Just check that it was called with a json compatible string
222223 output = mock_echo .call_args [0 ][0 ]
223- assert isinstance (output , dict )
224- assert "model_name" in output
224+ json_dict = json .loads (output )
225+ assert isinstance (json_dict , dict )
226+ assert "model_name" in json_dict
225227
226228 @patch ("click.echo" )
227229 def test_output_json_with_error_reasons (self , mock_echo ):
@@ -242,9 +244,10 @@ def test_output_json_with_error_reasons(self, mock_echo):
242244
243245 mock_echo .assert_called_once ()
244246 output = mock_echo .call_args [0 ][0 ]
245- assert isinstance (output , dict )
246- assert "pending_reason" in output
247- assert "failed_reason" in output
247+ json_dict = json .loads (output )
248+ assert isinstance (json_dict , dict )
249+ assert "pending_reason" in json_dict
250+ assert "failed_reason" in json_dict
248251
249252
250253class TestMetricsResponseFormatter :
0 commit comments