From b9d35597391ed76fd1f611991fea5bd83fa7feff Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven Date: Fri, 20 Sep 2024 13:25:14 +0200 Subject: [PATCH] thing --- mesa/__init__.py | 5 ----- tests/test_batch_run.py | 15 ++++++--------- tests/test_import_namespace.py | 28 ---------------------------- 3 files changed, 6 insertions(+), 42 deletions(-) delete mode 100644 tests/test_import_namespace.py diff --git a/mesa/__init__.py b/mesa/__init__.py index 7e3b014b817..e2b2bce32c2 100644 --- a/mesa/__init__.py +++ b/mesa/__init__.py @@ -8,8 +8,6 @@ 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__ = [ @@ -17,9 +15,6 @@ "Agent", "time", "space", - "DataCollector", - "batch_run", - "experimental", ] __title__ = "mesa" diff --git a/tests/test_batch_run.py b/tests/test_batch_run.py index ee18d0677c9..502c89e8f55 100644 --- a/tests/test_batch_run.py +++ b/tests/test_batch_run.py @@ -1,8 +1,7 @@ """Test Batchrunner.""" -import mesa from mesa.agent import Agent -from mesa.batchrunner import _make_model_kwargs +from mesa.batchrunner import _make_model_kwargs, batch_run from mesa.datacollection import DataCollector from mesa.model import Model from mesa.time import BaseScheduler @@ -103,7 +102,7 @@ def step(self): # noqa: D102 def test_batch_run(): # noqa: D103 - result = mesa.batch_run(MockModel, {}, number_processes=2) + result = batch_run(MockModel, {}, number_processes=2) assert result == [ { "RunId": 0, @@ -136,7 +135,7 @@ def test_batch_run(): # noqa: D103 def test_batch_run_with_params(): # noqa: D103 - mesa.batch_run( + batch_run( MockModel, { "variable_model_params": range(3), @@ -147,9 +146,7 @@ def test_batch_run_with_params(): # noqa: D103 def test_batch_run_no_agent_reporters(): # noqa: D103 - result = mesa.batch_run( - MockModel, {"enable_agent_reporters": False}, number_processes=2 - ) + result = batch_run(MockModel, {"enable_agent_reporters": False}, number_processes=2) print(result) assert result == [ { @@ -163,11 +160,11 @@ def test_batch_run_no_agent_reporters(): # noqa: D103 def test_batch_run_single_core(): # noqa: D103 - mesa.batch_run(MockModel, {}, number_processes=1, iterations=6) + batch_run(MockModel, {}, number_processes=1, iterations=6) def test_batch_run_unhashable_param(): # noqa: D103 - result = mesa.batch_run( + result = batch_run( MockModel, { "n_agents": 2, diff --git a/tests/test_import_namespace.py b/tests/test_import_namespace.py deleted file mode 100644 index 449727b95d8..00000000000 --- a/tests/test_import_namespace.py +++ /dev/null @@ -1,28 +0,0 @@ -"""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