diff --git a/mesa/examples/advanced/wolf_sheep/app.py b/mesa/examples/advanced/wolf_sheep/app.py index fa66d2bf11e..878c6797bed 100644 --- a/mesa/examples/advanced/wolf_sheep/app.py +++ b/mesa/examples/advanced/wolf_sheep/app.py @@ -83,7 +83,7 @@ def post_process_lines(ax): ) simulator = ABMSimulator() -model = WolfSheep(simulator, grass=True) +model = WolfSheep(simulator=simulator, grass=True) page = SolaraViz( model, diff --git a/mesa/visualization/solara_viz.py b/mesa/visualization/solara_viz.py index 8d9a2e25704..10718e8a804 100644 --- a/mesa/visualization/solara_viz.py +++ b/mesa/visualization/solara_viz.py @@ -276,7 +276,7 @@ def do_reset(): running.value = True simulator.reset() model.value = model.value = model.value.__class__( - simulator, **model_parameters.value + simulator=simulator, **model_parameters.value ) def do_play_pause(): diff --git a/tests/test_examples.py b/tests/test_examples.py index 98d1d5809ee..0e8a7edce42 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -13,6 +13,10 @@ def test_boltzmann_model(): # noqa: D103 + from mesa.examples.basic.boltzmann_wealth_model import app + + app.page # noqa: B018 + model = BoltzmannWealth(seed=42) for _i in range(10): @@ -20,24 +24,40 @@ def test_boltzmann_model(): # noqa: D103 def test_conways_game_model(): # noqa: D103 + from mesa.examples.basic.conways_game_of_life import app + + app.page # noqa: B018 + model = ConwaysGameOfLife(seed=42) for _i in range(10): model.step() def test_schelling_model(): # noqa: D103 + from mesa.examples.basic.schelling import app + + app.page # noqa: B018 + model = Schelling(seed=42) for _i in range(10): model.step() def test_virus_on_network(): # noqa: D103 + from mesa.examples.basic.virus_on_network import app + + app.page # noqa: B018 + model = VirusOnNetwork(seed=42) for _i in range(10): model.step() def test_boid_flockers(): # noqa: D103 + from mesa.examples.basic.boid_flockers import app + + app.page # noqa: B018 + model = BoidFlockers(seed=42) for _i in range(10): @@ -45,6 +65,10 @@ def test_boid_flockers(): # noqa: D103 def test_epstein(): # noqa: D103 + from mesa.examples.advanced.epstein_civil_violence import app + + app.page # noqa: B018 + model = EpsteinCivilViolence(seed=42) for _i in range(10): @@ -52,6 +76,10 @@ def test_epstein(): # noqa: D103 def test_pd_grid(): # noqa: D103 + from mesa.examples.advanced.pd_grid import app + + app.page # noqa: B018 + model = PdGrid(seed=42) for _i in range(10): @@ -59,6 +87,10 @@ def test_pd_grid(): # noqa: D103 def test_sugarscape_g1mt(): # noqa: D103 + from mesa.examples.advanced.sugarscape_g1mt import app + + app.page # noqa: B018 + model = SugarscapeG1mt(seed=42) for _i in range(10): @@ -66,8 +98,11 @@ def test_sugarscape_g1mt(): # noqa: D103 def test_wolf_sheep(): # noqa: D103 + from mesa.examples.advanced.wolf_sheep import app from mesa.experimental.devs import ABMSimulator + app.page # noqa: B018 + simulator = ABMSimulator() WolfSheep(seed=42, simulator=simulator) simulator.run_for(10)