def test_07MinutesRoundsDown(): tmpDt = datetime(now.year, now.month, now.day, now.hour, 7, tzinfo=utc) expected = datetime(now.year, now.month, now.day, now.hour, tzinfo=utc) assert roundToQuarterHour(tmpDt).isoformat() == expected.isoformat()
def test_53After23HoursRoundsToNextDay(): tmpDt = datetime(now.year, now.month, now.day, 23, 53, tzinfo=utc) expected = datetime(now.year, now.month, now.day + 1, 0, 0, tzinfo=utc) assert roundToQuarterHour(tmpDt).isoformat() == expected.isoformat()
def test_53After23HoursAtEndOfMonthRoundsToNextMonth(): tmpDt = datetime(now.year, 1, 31, 23, 53, tzinfo=utc) expected = datetime(now.year, 2, 1, 0, 0, tzinfo=utc) assert roundToQuarterHour(tmpDt).isoformat() == expected.isoformat()
def test_53MinutesRoundsUp(): tmpDt = datetime(now.year, now.month, now.day, now.hour, 53, tzinfo=utc) expected = datetime(now.year, now.month, now.day, now.hour + 1, 0, tzinfo=utc) assert roundToQuarterHour(tmpDt).isoformat() == expected.isoformat()