def test_parse_iso8601(self): # Default format using 'T' separator self.assertEqual(utils.parse_iso8601('2016-07-20T14:06:07'), datetime.datetime(2016, 7, 20, 14, 6, 7)) # Microseconds self.assertEqual(utils.parse_iso8601('2016-07-20T14:06:07.608319'), datetime.datetime(2016, 7, 20, 14, 6, 7, 608319)) # Space separator self.assertEqual(utils.parse_iso8601('2016-07-20 14:06:07'), datetime.datetime(2016, 7, 20, 14, 6, 7))
def get_dates(self): if self._dates is not _UNSET: return self._dates start = None end = None for run in self._runs: run_start = run._get_date() if run_start is None: continue run_start = parse_iso8601(run_start) duration = run._get_duration() duration = int(math.ceil(duration)) run_end = run_start + datetime.timedelta(seconds=duration) if start is None or run_start < start: start = run_start if end is None or run_end > end: end = run_end if start is not None: self._dates = (start, end) else: self._dates = None return self._dates