def test_range_hour(self): l = pud.range_dates("1999123122", "2000-01-01 01:00", increment_h=1) d = next(l) assert d.date() == datetime.date(1999, 12, 31) assert d.time() == datetime.time(22) d = next(l) assert d.date() == datetime.date(1999, 12, 31) assert d.time() == datetime.time(23) d = next(l) assert d.date() == datetime.date(2000, 1, 1) assert d.time() == datetime.time(0) d = next(l) assert d.date() == datetime.date(2000, 1, 1) assert d.time() == datetime.time(1) with pytest.raises(StopIteration): next(l)
def test_range_day(self): l = pud.range_dates("1999-12-30", "2000-01-02", increment_d=1) assert next(l).date() == datetime.date(1999, 12, 30) assert next(l).date() == datetime.date(1999, 12, 31) assert next(l).date() == datetime.date(2000, 1, 1)