From 79d04ecb482bbe7c135d915e29734c32696a2b71 Mon Sep 17 00:00:00 2001 From: Wang Boyu Date: Thu, 19 Dec 2024 16:45:00 -0500 Subject: [PATCH] fix broken mesa dependencies in GeoJupyterViz --- mesa_geo/visualization/geojupyter_viz.py | 4 ++-- tests/test_GeoJupyterViz.py | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mesa_geo/visualization/geojupyter_viz.py b/mesa_geo/visualization/geojupyter_viz.py index 87222028..8fd95159 100644 --- a/mesa_geo/visualization/geojupyter_viz.py +++ b/mesa_geo/visualization/geojupyter_viz.py @@ -1,10 +1,10 @@ import warnings import matplotlib.pyplot as plt -import mesa.experimental.components.matplotlib as components_matplotlib +import mesa.visualization.components.matplotlib_components as components_matplotlib import solara import xyzservices.providers as xyz -from mesa.experimental import solara_viz as jv +from mesa.visualization import solara_viz as jv from solara.alias import rv import mesa_geo.visualization.leaflet_viz as leaflet_viz diff --git a/tests/test_GeoJupyterViz.py b/tests/test_GeoJupyterViz.py index 1a646475..f071d0d7 100644 --- a/tests/test_GeoJupyterViz.py +++ b/tests/test_GeoJupyterViz.py @@ -60,20 +60,24 @@ def test_card_function( @patch("mesa_geo.visualization.geojupyter_viz.jv.ModelController") @patch("mesa_geo.visualization.geojupyter_viz.jv.UserInputs") @patch("mesa_geo.visualization.geojupyter_viz.jv.split_model_params") + @patch("mesa_geo.visualization.geojupyter_viz.jv.make_initial_grid_layout") @patch("mesa_geo.visualization.geojupyter_viz.solara.use_memo") @patch("mesa_geo.visualization.geojupyter_viz.solara.use_reactive") @patch("mesa_geo.visualization.geojupyter_viz.solara.use_state") @patch("mesa_geo.visualization.geojupyter_viz.solara.AppBarTitle") @patch("mesa_geo.visualization.geojupyter_viz.solara.AppBar") @patch("mesa_geo.visualization.geojupyter_viz.leaflet_viz.MapModule") + @patch("mesa_geo.visualization.geojupyter_viz.rv.Card") def test_geojupyterviz_function( self, + mock_rv_Card, # noqa: N803 mock_MapModule, # noqa: N803 mock_AppBar, # noqa: N803 mock_AppBarTitle, # noqa: N803 mock_use_state, mock_use_reactive, mock_use_memo, + mock_make_initial_grid_layout, mock_split_model_params, mock_UserInputs, # noqa: N803 mock_ModelController, # noqa: N803 @@ -96,6 +100,10 @@ def test_geojupyterviz_function( mock_split_model_params.return_value = ({}, {}) mock_use_state.return_value = ({}, MagicMock()) mock_use_memo.return_value = MagicMock() + mock_make_initial_grid_layout.return_value = {} + + mock_rv_Card.return_value.__enter__ = MagicMock() + mock_rv_Card.return_value.__exit__ = MagicMock() solara.render( GeoJupyterViz(