def test_utc(): utc = UTC() assert utc.tzname(None) == 'UTC' assert utc.utcoffset(None) == datetime.timedelta(0) assert utc.dst(None) == datetime.timedelta(0) assert repr(utc) == str('<UTC>') assert str(utc) == str('UTC')
def _iter_dates(days_number, reverse=False): """Return a list of datetime pairs AB, BC, CD, ... that represent the 24hs time ranges of today (until this midnight) and the previous days. """ one_day = timedelta(days=1) today = datetime.utcnow().replace(hour=0, minute=0, second=0, microsecond=0, tzinfo=UTC()) days_list = list(today + one_day * (1 - i) for i in range(days_number + 1)) if reverse: days_list.reverse() return zip(days_list, days_list[1:]) return zip(days_list[1:], days_list)
def get_node_unreported_time(): return (datetime.datetime.utcnow() - timedelta(hours=app.config['UNRESPONSIVE_HOURS'])).replace( microsecond=0, tzinfo=UTC())
def test_utc(): utc = UTC() assert utc.tzname(None) == 'UTC' assert utc.utcoffset(None) == datetime.timedelta(0) assert utc.dst(None) == datetime.timedelta(0)