def test_parse_time_interval(self): """ basic test the parsing method for timedelta values pass a value, check if is correctly transformed in a timedelta """ # 1 day val = parse_time_interval('1 day') assert val == timedelta(days=1) # 2 weeks val = parse_time_interval('2 weeks') assert val == timedelta(days=14) # 3 months val = parse_time_interval('3 months') assert val == timedelta(days=93) # this string is something that the regexp cannot manage, # so we expect a ValueError exception with pytest.raises(ValueError): parse_time_interval('test_string')
def test_parse_time_interval(self): """ basic test the parsing method for timedelta values pass a value, check if is correctly transformed in a timedelta """ # 1 day val = parse_time_interval('1 day') assert val == timedelta(days=1) # 2 weeks val = parse_time_interval('2 weeks') assert val == timedelta(days=14) # 3 months val = parse_time_interval('3 months') assert val == timedelta(days=93) # this string is something that the regexp cannot manage, # so we expect a ValueError exception with pytest.raises(ValueError): parse_time_interval('test_string')