def test_deltas_iter(self): ev_dt = EventTimeDeltas() dts = list(ev_dt.deltas_iter(0,10,1)) self.assertEquals(10, len(dts)) expected = (0, [[120], [240], [360], [480], [600], [720]]) self.assertEquals(expected, dts[0]) ev_dt = EventTimeDeltas("faulty_flasher") dts = list(ev_dt.deltas_iter(0,4,2)) self.assertEquals(2, len(dts)) expected = (7, [[120], [240], [360, 480, 600], [], [], []]) self.assertEquals(expected, dts[1])
def test_deltas_iter(self): ev_dt = EventTimeDeltas() dts = list(ev_dt.deltas_iter(0, 10, 1)) self.assertEquals(10, len(dts)) expected = (0, [[120], [240], [360], [480], [600], [720]]) self.assertEquals(expected, dts[0]) ev_dt = EventTimeDeltas("faulty_flasher") dts = list(ev_dt.deltas_iter(0, 4, 2)) self.assertEquals(2, len(dts)) expected = (7, [[120], [240], [360, 480, 600], [], [], []]) self.assertEquals(expected, dts[1])
def get_timedeltas(request, start, stop, step, device_group): """ Providing the time deltas for all the steps in a testrun associated with a testrun_id. The order of the testrun_ids are chronological (or reverse chrono for a -1 step) @type start: C{int} @param start: The start index of the iteration @type stop: C{int} @param stop: The stop index of the iteration @type step: C{int} @param step: The step of the iteration @type device_group: C{str} @param device_group: The name of the device group None returns all device groups @rtype: A C{list} of [C{tuple} of (C{str}, [C{list} of [C{list} of C{float}]])] @return: A tuple of the testrun_id and the time deltas for all the steps in the testrun """ ev_dt = EventTimeDeltas(device_group) return list(ev_dt.deltas_iter(start, stop, step))
def get_timedeltas(request, start, stop, step, device_group): """ Providing the time deltas for all the steps in a testrun associated with a testrun_id. The order of the testrun_ids are chronological (or reverse chrono for a -1 step) @type start: C{int} @param start: The start index of the iteration @type stop: C{int} @param stop: The stop index of the iteration @type step: C{int} @param step: The step of the iteration @type device_group: C{str} @param device_group: The name of the device group None returns all device groups @rtype: A C{list} of [C{tuple} of (C{str}, [C{list} of [C{list} of C{float}]])] @return: A tuple of the testrun_id and the time deltas for all the steps in the testrun """ ev_dt = EventTimeDeltas(device_group) return list(ev_dt.deltas_iter(start, stop, step))