Skip to content

Commit

Permalink
Add regression test for previously broken behaviour
Browse files Browse the repository at this point in the history
This was originally discovered by Hypothesis, although the example
required shrinking by hand.
  • Loading branch information
evansd committed Nov 28, 2024
1 parent 6e0b140 commit b748589
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/integration/test_query_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,23 @@ def test_population_which_uses_combine_as_set_and_no_patient_frame(engine):
assert engine.extract_qm(variables) == [
{"patient_id": 1, "v": True},
]


def test_picking_row_doesnt_cause_filtered_rows_to_reappear(engine):
# Regression test for a bug we introduced in the in-memory engine
dataset = create_dataset()
dataset.define_population(events.exists_for_patient())

rows = events.where(events.i < 0).sort_by(events.i).first_for_patient()
dataset.has_row = rows.exists_for_patient()
dataset.row_count = rows.count_for_patient()

engine.populate(
{
events: [{"patient_id": 1, "i": 2}],
}
)

assert engine.extract(dataset) == [
{"patient_id": 1, "has_row": False, "row_count": 0},
]

0 comments on commit b748589

Please sign in to comment.