Skip to content

Commit

Permalink
Wrote test for remove_agent in NetworkGrid
Browse files Browse the repository at this point in the history
  • Loading branch information
Casper Smet committed Mar 4, 2021
1 parent d907d3b commit b126169
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,15 @@ def test_move_agent(self):
assert _agent not in self.space.G.nodes[initial_pos]["agent"]
assert _agent in self.space.G.nodes[final_pos]["agent"]

def test_remove_agent(self):
for i, pos in enumerate(TEST_AGENTS_NETWORK_SINGLE):
a = self.agents[i]
assert a.pos == pos
assert a in self.space.G.nodes[pos]["agent"]
self.space.remove_agent(a)
assert a.pos is None
assert a not in self.space.G.nodes[pos]["agent"]

def test_is_cell_empty(self):
assert not self.space.is_cell_empty(0)
assert self.space.is_cell_empty(TestSingleNetworkGrid.GRAPH_SIZE - 1)
Expand Down

0 comments on commit b126169

Please sign in to comment.