From afd395911d324e086787412de3d292c3012df041 Mon Sep 17 00:00:00 2001 From: Jan Kwakkel Date: Sun, 29 Sep 2024 20:55:04 +0200 Subject: [PATCH] add super call to Model and remove self.schedule (#2334) * Update model.py * test and benchmark fixes --- benchmarks/BoltzmannWealth/boltzmann_wealth.py | 2 +- mesa/model.py | 2 +- tests/test_model.py | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/benchmarks/BoltzmannWealth/boltzmann_wealth.py b/benchmarks/BoltzmannWealth/boltzmann_wealth.py index 5423eb82164..2d863efcb8d 100644 --- a/benchmarks/BoltzmannWealth/boltzmann_wealth.py +++ b/benchmarks/BoltzmannWealth/boltzmann_wealth.py @@ -40,7 +40,7 @@ def __init__(self, seed=None, n=100, width=10, height=10): width: the width of the grid height: the height of the grid """ - super().__init__(seed) + super().__init__(seed=seed) self.num_agents = n self.grid = mesa.space.MultiGrid(width, height, True) self.datacollector = mesa.DataCollector( diff --git a/mesa/model.py b/mesa/model.py index d9566f44f3c..e4f70793c0e 100644 --- a/mesa/model.py +++ b/mesa/model.py @@ -48,8 +48,8 @@ def __init__(self, *args: Any, seed: float | None = None, **kwargs: Any) -> None seed: the seed for the random number generator kwargs: keyword arguments to pass onto super """ + super().__init__(*args, **kwargs) self.running = True - self.schedule = None self.steps: int = 0 self._setup_agent_registration() diff --git a/tests/test_model.py b/tests/test_model.py index c7d17bf806d..1931e002b54 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -8,7 +8,6 @@ def test_model_set_up(): """Test Model initialization.""" model = Model() assert model.running is True - assert model.schedule is None assert model.steps == 0 model.step() assert model.steps == 1