Skip to content

Commit 77cc917

Browse files
committed
Revert "thing"
This reverts commit b9d3559.
1 parent 7433165 commit 77cc917

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

mesa/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@
88
import mesa.space as space
99
import mesa.time as time
1010
from mesa.agent import Agent
11+
from mesa.batchrunner import batch_run
12+
from mesa.datacollection import DataCollector
1113
from mesa.model import Model
1214

1315
__all__ = [
1416
"Model",
1517
"Agent",
1618
"time",
1719
"space",
20+
"DataCollector",
21+
"batch_run",
22+
"experimental",
1823
]
1924

2025
__title__ = "mesa"

tests/test_batch_run.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""Test Batchrunner."""
22

3+
import mesa
34
from mesa.agent import Agent
4-
from mesa.batchrunner import _make_model_kwargs, batch_run
5+
from mesa.batchrunner import _make_model_kwargs
56
from mesa.datacollection import DataCollector
67
from mesa.model import Model
78
from mesa.time import BaseScheduler
@@ -102,7 +103,7 @@ def step(self): # noqa: D102
102103

103104

104105
def test_batch_run(): # noqa: D103
105-
result = batch_run(MockModel, {}, number_processes=2)
106+
result = mesa.batch_run(MockModel, {}, number_processes=2)
106107
assert result == [
107108
{
108109
"RunId": 0,
@@ -135,7 +136,7 @@ def test_batch_run(): # noqa: D103
135136

136137

137138
def test_batch_run_with_params(): # noqa: D103
138-
batch_run(
139+
mesa.batch_run(
139140
MockModel,
140141
{
141142
"variable_model_params": range(3),
@@ -146,7 +147,9 @@ def test_batch_run_with_params(): # noqa: D103
146147

147148

148149
def test_batch_run_no_agent_reporters(): # noqa: D103
149-
result = batch_run(MockModel, {"enable_agent_reporters": False}, number_processes=2)
150+
result = mesa.batch_run(
151+
MockModel, {"enable_agent_reporters": False}, number_processes=2
152+
)
150153
print(result)
151154
assert result == [
152155
{
@@ -160,11 +163,11 @@ def test_batch_run_no_agent_reporters(): # noqa: D103
160163

161164

162165
def test_batch_run_single_core(): # noqa: D103
163-
batch_run(MockModel, {}, number_processes=1, iterations=6)
166+
mesa.batch_run(MockModel, {}, number_processes=1, iterations=6)
164167

165168

166169
def test_batch_run_unhashable_param(): # noqa: D103
167-
result = batch_run(
170+
result = mesa.batch_run(
168171
MockModel,
169172
{
170173
"n_agents": 2,

tests/test_import_namespace.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""Test if namespsaces importing work better."""
2+
3+
4+
def test_import():
5+
"""This tests the new, simpler Mesa namespace.
6+
7+
See https://github.com/projectmesa/mesa/pull/1294.
8+
"""
9+
import mesa
10+
from mesa.time import RandomActivation
11+
12+
_ = mesa.time.RandomActivation
13+
_ = RandomActivation
14+
15+
from mesa.space import MultiGrid
16+
17+
_ = mesa.space.MultiGrid
18+
_ = MultiGrid
19+
20+
from mesa.datacollection import DataCollector
21+
22+
_ = DataCollector
23+
_ = mesa.DataCollector
24+
25+
from mesa.batchrunner import batch_run
26+
27+
_ = batch_run
28+
_ = mesa.batch_run

0 commit comments

Comments
 (0)