def filter_since_date(pubs, since_date): """Filter the publications after the since_date.""" for pub in pubs: if isinstance(pub.get("year"), str): pub["year"] = int(pub.get("year")) if has_started(pub, since_date): if not pub.get("month"): print("WARNING: {} is missing month".format(pub["_id"])) if pub.get("month") == "tbd".casefold(): print("WARNING: month in {} is tbd".format(pub["_id"])) yield pub
def test_has_started(thing, expected, now=TEST_DATE): assert has_started(thing, now=now) == expected