66import pytest
77
88from dash .mcp .primitives .tools .results .result_plotly_figure import (
9- plotly_figure_result ,
9+ PlotlyFigureResult ,
1010)
1111
1212go = pytest .importorskip ("plotly.graph_objects" )
@@ -28,15 +28,15 @@ class TestPlotlyFigureResult:
2828 def test_returns_image_when_kaleido_available (self ):
2929 fig_dict = go .Figure (data = [go .Bar (x = ["A" , "B" ], y = [1 , 2 ])]).to_plotly_json ()
3030 with patch .object (go .Figure , "to_image" , return_value = FAKE_PNG ):
31- result = plotly_figure_result (GRAPH_FIGURE_OUTPUT , fig_dict )
31+ result = PlotlyFigureResult . format (GRAPH_FIGURE_OUTPUT , fig_dict )
3232 assert len (result ) == 1
3333 assert result [0 ].type == "image"
3434 assert result [0 ].data == FAKE_B64
3535
3636 def test_returns_empty_when_kaleido_unavailable (self ):
3737 fig_dict = go .Figure (data = [go .Bar (x = ["A" , "B" ], y = [1 , 2 ])]).to_plotly_json ()
3838 with patch .object (go .Figure , "to_image" , side_effect = ImportError ):
39- result = plotly_figure_result (GRAPH_FIGURE_OUTPUT , fig_dict )
39+ result = PlotlyFigureResult . format (GRAPH_FIGURE_OUTPUT , fig_dict )
4040 assert result == []
4141
4242 def test_ignores_non_graph_components (self ):
@@ -45,11 +45,11 @@ def test_ignores_non_graph_components(self):
4545 "component_type" : "Div" ,
4646 "property" : "children" ,
4747 }
48- assert plotly_figure_result (output , {}) == []
48+ assert PlotlyFigureResult . format (output , {}) == []
4949
5050 def test_ignores_non_figure_props (self ):
5151 output = {** GRAPH_FIGURE_OUTPUT , "property" : "clickData" }
52- assert plotly_figure_result (output , {}) == []
52+ assert PlotlyFigureResult . format (output , {}) == []
5353
5454 def test_ignores_non_dict_values (self ):
55- assert plotly_figure_result (GRAPH_FIGURE_OUTPUT , "not a dict" ) == []
55+ assert PlotlyFigureResult . format (GRAPH_FIGURE_OUTPUT , "not a dict" ) == []
0 commit comments