def test_delta_days(self):
     expected = '24h0m5s'
     result = time_between(datetime(2018, 1, 1, 10, 10, 20),
                           datetime(2018, 1, 2, 10, 10, 25))
     self.assertEqual(expected,
                      result,
                      msg="Delta days must be add on hours value.")
Beispiel #2
0
    def duration(self):
        if not (self.detail_start and self.detail_end):
            return '0h0m0s'

        return time_between(self.detail_start.timestamp,
                            self.detail_end.timestamp)
 def test_delta_seconds(self):
     expected = '0h0m5s'
     result = time_between(datetime(2018, 1, 1, 10, 10, 20),
                           datetime(2018, 1, 1, 10, 10, 25))
     self.assertEqual(expected, result)
 def test_delta_hours_minutes_seconds(self):
     expected = '1h5m5s'
     result = time_between(datetime(2018, 1, 1, 10, 10, 20),
                           datetime(2018, 1, 1, 11, 15, 25))
     self.assertEqual(expected, result)