Skip to content

Commit a2bc8e8

Browse files
committed
final pg test
1 parent 220025b commit a2bc8e8

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

mesa_frames/concrete/datacollector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,9 @@ def _validate_reporter_table_columns(
430430
for col_name, required_column in reporter.items():
431431
if isinstance(required_column, str):
432432
for k, v in self._model.agents[required_column].items():
433-
expected_columns.add(col_name + "_" + str(k.__class__.__name__))
433+
expected_columns.add((col_name + "_" + str(k.__class__.__name__)).lower())
434434
else:
435-
expected_columns.add(col_name)
435+
expected_columns.add(col_name.lower())
436436

437437
query = f"""
438438
SELECT column_name

tests/test_datacollector.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def test_postgress(self, fix1_model, postgres_uri):
433433
)
434434
""")
435435
conn.commit()
436-
436+
437437
model.dc = DataCollector(
438438
model=model,
439439
trigger=custom_trigger,
@@ -461,9 +461,14 @@ def test_postgress(self, fix1_model, postgres_uri):
461461
model_rows = cur.fetchall()
462462
assert model_rows == [(2, 12), (4, 12)]
463463

464-
cur.execute("SELECT step, wealth FROM agent_data WHERE step=2 ORDER BY wealth")
464+
cur.execute("SELECT step, wealth,age_ExampleAgentSet1, age_ExampleAgentSet2, age_ExampleAgentSet3 FROM agent_data WHERE step=2 ORDER BY wealth")
465465
agent_rows = cur.fetchall()
466-
assert agent_rows == [(2, 3), (2, 4), (2, 5), (2, 6)]
466+
assert agent_rows == [
467+
(2, 3, 10, 11, 3),
468+
(2, 4, 20, 22, 4),
469+
(2, 5, 30, 33, 5),
470+
(2, 6, 40, 44, 6),
471+
]
467472

468473
cur.close()
469474
conn.close()

0 commit comments

Comments
 (0)