Skip to content

Commit

Permalink
Update test_space.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Corvince committed Aug 5, 2019
1 parent f77e74c commit 092b922
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/test_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import networkx as nx
import numpy as np
import pytest

from mesa.space import ContinuousSpace
from mesa.space import SingleGrid
Expand Down Expand Up @@ -249,7 +250,7 @@ def test_remove_middle(self):

class TestSingleGrid(unittest.TestCase):
def setUp(self):
self.space = SingleGrid(20, 20, False)
self.space = SingleGrid(50, 50, False)
self.agents = []
for i, pos in enumerate(TEST_AGENTS_GRID):
a = MockAgent(i, None)
Expand All @@ -274,10 +275,11 @@ def test_remove_agent(self):
assert self.space.grid[pos[0]][pos[1]] is None

def test_empty_cells(self):
while self.space.exists_empty_cells():
pos = self.space.find_empty()
a = MockAgent(-99, pos)
self.space.position_agent(a, x=pos[0], y=pos[1])
if self.space.exists_empty_cells():
pytest.deprecated_call(self.space.find_empty)
for i, pos in enumerate(list(self.space.empties)):
a = MockAgent(-i, pos)
self.space.position_agent(a, x=pos[0], y=pos[1])
assert self.space.find_empty() is None
with self.assertRaises(Exception):
self.space.move_to_empty(a)
Expand Down

0 comments on commit 092b922

Please sign in to comment.