Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
- min/max date: check that silently passing invalid values (e.g. "?") get filtered out
  • Loading branch information
victorlin committed Mar 11, 2022
1 parent 27e934c commit 85ece02
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/test_filter_filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def test_filter_by_min_date(self, tmpdir):
data = [("strain","date"),
("SEQ_1","2020-02-XX"),
("SEQ_2","2020-02-26"),
("SEQ_3","2020-02-25")]
("SEQ_3","2020-02-25"),
("SEQ_4","?")]
args = get_valid_args(data, tmpdir)
args.min_date = '2020-02-26'
filter_obj = get_filter_obj_run(args)
Expand All @@ -97,14 +98,15 @@ def test_filter_by_min_date(self, tmpdir):
FROM {METADATA_FILTER_REASON_TABLE_NAME}
WHERE {FILTER_REASON_COL} = 'filter_by_min_date'
""")
assert results == [("SEQ_3",)]
assert results == [("SEQ_3",), ("SEQ_4",)]

def test_filter_by_max_date(self, tmpdir):
"""Filter by max date, inclusive."""
data = [("strain","date"),
("SEQ_1","2020-03-XX"),
("SEQ_2","2020-03-01"),
("SEQ_3","2020-03-02")]
("SEQ_3","2020-03-02"),
("SEQ_4","?")]
args = get_valid_args(data, tmpdir)
args.max_date = '2020-03-01'
filter_obj = get_filter_obj_run(args)
Expand All @@ -113,7 +115,7 @@ def test_filter_by_max_date(self, tmpdir):
FROM {METADATA_FILTER_REASON_TABLE_NAME}
WHERE {FILTER_REASON_COL} = 'filter_by_max_date'
""")
assert results == [("SEQ_3",)]
assert results == [("SEQ_3",), ("SEQ_4",)]

def test_filter_by_ambiguous_date_year(self, tmpdir):
"""Filter out dates with ambiguous year."""
Expand Down

0 comments on commit 85ece02

Please sign in to comment.