Skip to content

Commit

Permalink
Revert "thing"
Browse files Browse the repository at this point in the history
This reverts commit b9d3559.
  • Loading branch information
EwoutH committed Sep 26, 2024
1 parent 7433165 commit 77cc917
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
5 changes: 5 additions & 0 deletions mesa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@
import mesa.space as space
import mesa.time as time
from mesa.agent import Agent
from mesa.batchrunner import batch_run
from mesa.datacollection import DataCollector
from mesa.model import Model

__all__ = [
"Model",
"Agent",
"time",
"space",
"DataCollector",
"batch_run",
"experimental",
]

__title__ = "mesa"
Expand Down
15 changes: 9 additions & 6 deletions tests/test_batch_run.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Test Batchrunner."""

import mesa
from mesa.agent import Agent
from mesa.batchrunner import _make_model_kwargs, batch_run
from mesa.batchrunner import _make_model_kwargs
from mesa.datacollection import DataCollector
from mesa.model import Model
from mesa.time import BaseScheduler
Expand Down Expand Up @@ -102,7 +103,7 @@ def step(self): # noqa: D102


def test_batch_run(): # noqa: D103
result = batch_run(MockModel, {}, number_processes=2)
result = mesa.batch_run(MockModel, {}, number_processes=2)
assert result == [
{
"RunId": 0,
Expand Down Expand Up @@ -135,7 +136,7 @@ def test_batch_run(): # noqa: D103


def test_batch_run_with_params(): # noqa: D103
batch_run(
mesa.batch_run(
MockModel,
{
"variable_model_params": range(3),
Expand All @@ -146,7 +147,9 @@ def test_batch_run_with_params(): # noqa: D103


def test_batch_run_no_agent_reporters(): # noqa: D103
result = batch_run(MockModel, {"enable_agent_reporters": False}, number_processes=2)
result = mesa.batch_run(
MockModel, {"enable_agent_reporters": False}, number_processes=2
)
print(result)
assert result == [
{
Expand All @@ -160,11 +163,11 @@ def test_batch_run_no_agent_reporters(): # noqa: D103


def test_batch_run_single_core(): # noqa: D103
batch_run(MockModel, {}, number_processes=1, iterations=6)
mesa.batch_run(MockModel, {}, number_processes=1, iterations=6)


def test_batch_run_unhashable_param(): # noqa: D103
result = batch_run(
result = mesa.batch_run(
MockModel,
{
"n_agents": 2,
Expand Down
28 changes: 28 additions & 0 deletions tests/test_import_namespace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Test if namespsaces importing work better."""


def test_import():
"""This tests the new, simpler Mesa namespace.
See https://github.com/projectmesa/mesa/pull/1294.
"""
import mesa
from mesa.time import RandomActivation

_ = mesa.time.RandomActivation
_ = RandomActivation

from mesa.space import MultiGrid

_ = mesa.space.MultiGrid
_ = MultiGrid

from mesa.datacollection import DataCollector

_ = DataCollector
_ = mesa.DataCollector

from mesa.batchrunner import batch_run

_ = batch_run
_ = mesa.batch_run

0 comments on commit 77cc917

Please sign in to comment.