Skip to content

Commit 0b9cc1c

Browse files
Corvincepre-commit-ci[bot]quaquel
authored
test app init of examples (#2491)
test app init of examples --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jan Kwakkel <[email protected]>
1 parent c53223e commit 0b9cc1c

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

mesa/examples/advanced/wolf_sheep/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def post_process_lines(ax):
8383
)
8484

8585
simulator = ABMSimulator()
86-
model = WolfSheep(simulator, grass=True)
86+
model = WolfSheep(simulator=simulator, grass=True)
8787

8888
page = SolaraViz(
8989
model,

mesa/visualization/solara_viz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def do_reset():
276276
running.value = True
277277
simulator.reset()
278278
model.value = model.value = model.value.__class__(
279-
simulator, **model_parameters.value
279+
simulator=simulator, **model_parameters.value
280280
)
281281

282282
def do_play_pause():

tests/test_examples.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,61 +13,96 @@
1313

1414

1515
def test_boltzmann_model(): # noqa: D103
16+
from mesa.examples.basic.boltzmann_wealth_model import app
17+
18+
app.page # noqa: B018
19+
1620
model = BoltzmannWealth(seed=42)
1721

1822
for _i in range(10):
1923
model.step()
2024

2125

2226
def test_conways_game_model(): # noqa: D103
27+
from mesa.examples.basic.conways_game_of_life import app
28+
29+
app.page # noqa: B018
30+
2331
model = ConwaysGameOfLife(seed=42)
2432
for _i in range(10):
2533
model.step()
2634

2735

2836
def test_schelling_model(): # noqa: D103
37+
from mesa.examples.basic.schelling import app
38+
39+
app.page # noqa: B018
40+
2941
model = Schelling(seed=42)
3042
for _i in range(10):
3143
model.step()
3244

3345

3446
def test_virus_on_network(): # noqa: D103
47+
from mesa.examples.basic.virus_on_network import app
48+
49+
app.page # noqa: B018
50+
3551
model = VirusOnNetwork(seed=42)
3652
for _i in range(10):
3753
model.step()
3854

3955

4056
def test_boid_flockers(): # noqa: D103
57+
from mesa.examples.basic.boid_flockers import app
58+
59+
app.page # noqa: B018
60+
4161
model = BoidFlockers(seed=42)
4262

4363
for _i in range(10):
4464
model.step()
4565

4666

4767
def test_epstein(): # noqa: D103
68+
from mesa.examples.advanced.epstein_civil_violence import app
69+
70+
app.page # noqa: B018
71+
4872
model = EpsteinCivilViolence(seed=42)
4973

5074
for _i in range(10):
5175
model.step()
5276

5377

5478
def test_pd_grid(): # noqa: D103
79+
from mesa.examples.advanced.pd_grid import app
80+
81+
app.page # noqa: B018
82+
5583
model = PdGrid(seed=42)
5684

5785
for _i in range(10):
5886
model.step()
5987

6088

6189
def test_sugarscape_g1mt(): # noqa: D103
90+
from mesa.examples.advanced.sugarscape_g1mt import app
91+
92+
app.page # noqa: B018
93+
6294
model = SugarscapeG1mt(seed=42)
6395

6496
for _i in range(10):
6597
model.step()
6698

6799

68100
def test_wolf_sheep(): # noqa: D103
101+
from mesa.examples.advanced.wolf_sheep import app
69102
from mesa.experimental.devs import ABMSimulator
70103

104+
app.page # noqa: B018
105+
71106
simulator = ABMSimulator()
72107
WolfSheep(seed=42, simulator=simulator)
73108
simulator.run_for(10)

0 commit comments

Comments
 (0)