Skip to content

Commit

Permalink
fix test_examples failure
Browse files Browse the repository at this point in the history
  • Loading branch information
tpike3 committed Aug 30, 2020
1 parent 899ce22 commit 230590d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions mesa/datacollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ def get_agent_vars_dataframe(self):
df = pd.DataFrame.from_records(
data=all_records, columns=["Step", "AgentID"] + rep_names,
)
df = df.set_index(["Step", "AgentID"])
return df

def get_table_dataframe(self, table_name):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_batchrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def test_agent_level_vars(self):
assert "agent_val" in list(agent_vars.columns)
assert "val_non_existent" not in list(agent_vars.columns)
assert "agent_id" in list(agent_collector[(0, 1, 1)].columns)
assert "Step" in list(agent_collector[(0, 1, 5)].columns)
assert "Step" in list(agent_collector[(0, 1, 5)].index)
assert "nose" not in list(agent_collector[(0, 1, 1)].columns)

self.assertEqual(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_batchrunnerMP.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def test_agent_level_vars(self):
assert "agent_val" in list(agent_vars.columns)
assert "val_non_existent" not in list(agent_vars.columns)
assert "agent_id" in list(agent_collector[(0, 1, 1)].columns)
assert "Step" in list(agent_collector[(0, 1, 5)].columns)
assert "Step" in list(agent_collector[(0, 1, 5)].index)
assert "nose" not in list(agent_collector[(0, 1, 1)].columns)

self.assertEqual(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_datacollector.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def test_exports(self):
agent_vars = data_collector.get_agent_vars_dataframe()
table_df = data_collector.get_table_dataframe("Final_Values")
assert model_vars.shape == (7, 5)
assert agent_vars.shape == (70, 4)
assert agent_vars.shape == (70, 2)
assert table_df.shape == (10, 2)

with self.assertRaises(Exception):
Expand Down

0 comments on commit 230590d

Please sign in to comment.