Пример #1
0
def test_interval_should_be_creatable_from_local_datetime():
    test_start = datetime.now(tz=tz.tzlocal()).replace(microsecond=0)
    test_end = test_start + timedelta(hours=1)

    interval = TimeWarriorInterval(1, test_start, test_end, [], None)

    assert interval.get_start() == test_start \
           and interval.get_end() == test_end \
           and interval.get_start_date() == test_start.date() \
           and interval.get_end_date() == test_end.date()
Пример #2
0
def test_interval_should_be_creatable_from_utc_string():
    test_start = datetime.now(tz=tz.tzlocal()).replace(microsecond=0)
    test_start_utc = test_start.utcnow()
    test_end = test_start + timedelta(hours=1)
    test_end_utc = test_start_utc + timedelta(hours=1)

    interval = TimeWarriorInterval(1,
                                   "{:%Y%m%dT%H%M%S}Z".format(test_start_utc),
                                   "{:%Y%m%dT%H%M%S}Z".format(test_end_utc),
                                   [], None)

    assert interval.get_start() == test_start \
           and interval.get_end() == test_end \
           and interval.get_start_date() == test_start.date() \
           and interval.get_end_date() == test_end.date()