Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test app init of examples #2491

Merged
merged 6 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mesa/examples/advanced/wolf_sheep/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion mesa/visualization/solara_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
35 changes: 35 additions & 0 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,61 +13,96 @@


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):
model.step()


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):
model.step()


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):
model.step()


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):
model.step()


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):
model.step()


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)
Loading