@@ -105,8 +105,9 @@ def test_mpl_space_component(self, mock_model):
105
105
component = make_mpl_space_component (self .agent_portrayal )
106
106
assert callable (component ), "Component should be callable"
107
107
108
- viz_func = component (mock_model )
109
- assert callable (viz_func ), "Visualization function should be callable"
108
+ viz_component = component (mock_model )
109
+ assert viz_component is not None , "Visualization component should not be None"
110
+ assert "SpaceMatplotlib" in str (viz_component ), "Component should be a SpaceMatplotlib"
110
111
111
112
def test_mpl_plot_component (self , mock_model ):
112
113
"""Test that matplotlib plot component can be created."""
@@ -118,7 +119,7 @@ def post_process(fig, ax):
118
119
119
120
component_with_custom = make_mpl_plot_component (
120
121
{"data1" : "red" },
121
- x_data = lambda model : np . arange ( len ( model . time_series_data [ "data1" ])),
122
+
122
123
post_process = post_process ,
123
124
)
124
125
assert callable (component_with_custom ), "Component with custom post-processing should be callable"
@@ -165,7 +166,7 @@ def test_schelling_visualization(self):
165
166
assert callable (component ), "Component should be callable"
166
167
167
168
viz = SolaraViz (model , components = [component ], model_params = model_params )
168
- assert hasattr ( viz , "model" ) , "SolaraViz should have model attribute "
169
+ assert viz is not None , "SolaraViz should create a visualization object "
169
170
170
171
except (ImportError , AttributeError ):
171
172
pass
@@ -225,8 +226,7 @@ def agent_portrayal(agent):
225
226
component = make_altair_space (agent_portrayal )
226
227
viz = SolaraViz (model , components = [component ], play_interval = 10 )
227
228
228
- assert hasattr (viz , "model" ), "SolaraViz should have model attribute"
229
- assert hasattr (viz , "components" ), "SolaraViz should have components attribute"
229
+ assert viz is not None , "SolaraViz should create a visualization object"
230
230
231
231
except (ImportError , AttributeError ):
232
232
pass
0 commit comments