def it_should_parse_complex_durations_with_start(self): start = datetime.datetime(2000, 1, 1) result = parse_duration_with_start(start, 'P3Y2M3DT1H1M1S') self.assertEqual(result, (start, datetime.timedelta(days=1158, seconds=3661))) result = parse_duration('P3Y2M3DT1H1M1S', start=start) self.assertEqual(result, (start, datetime.timedelta(days=1158, seconds=3661)))
def it_should_parse_durations_with_start(self): start = datetime.datetime(2000, 1, 1) result = parse_duration_with_start(start, 'P3Y') self.assertEqual(result, (start, datetime.timedelta(days=1096))) result = parse_duration('P3Y', start=start) self.assertEqual(result, (start, datetime.timedelta(days=1096)))