Skip to content

Commit

Permalink
fix test context
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamZh0u committed Dec 17, 2024
1 parent 383cce3 commit b755efa
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions tests/test_GeoJupyterViz.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,27 +60,31 @@ 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_MapModule, # noqa: N803
mock_AppBar, # noqa: N803
mock_AppBarTitle, # noqa: N803
mock_rv_Card,
mock_MapModule,
mock_AppBar,
mock_AppBarTitle,
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
mock_Markdown, # noqa: N803
mock_Card, # noqa: N803
mock_Sidebar, # noqa: N803
mock_GridDraggable, # noqa: N803
mock_UserInputs,
mock_ModelController,
mock_Markdown,
mock_Card,
mock_Sidebar,
mock_GridDraggable,
):
model_class = MagicMock()
model_params = MagicMock()
Expand All @@ -96,20 +100,22 @@ 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(
model_class=model_class,
model_params=model_params,
measures=measures,
name=name,
agent_portrayal=agent_portrayal,
play_interval=play_interval,
view=view,
zoom=zoom,
center_point=center_point,
)
)
solara.render(GeoJupyterViz(
model_class=model_class,
model_params=model_params,
measures=measures,
name=name,
agent_portrayal=agent_portrayal,
play_interval=play_interval,
view=view,
zoom=zoom,
center_point=center_point,
))

mock_AppBar.assert_called_once()
mock_AppBarTitle.assert_called_once_with(name)
Expand Down

0 comments on commit b755efa

Please sign in to comment.