-
Notifications
You must be signed in to change notification settings - Fork 929
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for agent removal and model agent_types property
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from mesa.agent import Agent | ||
from mesa.model import Model | ||
|
||
|
||
def test_agent_removal(): | ||
class TestAgent(Agent): | ||
pass | ||
|
||
model = Model() | ||
agent = TestAgent(model.next_id(), model) | ||
# Check if the agent is added | ||
assert agent in model.agents[type(agent)] | ||
|
||
agent.remove() | ||
# Check if the agent is removed | ||
assert agent not in model.agents[type(agent)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters