'Test computation of event duration before the end of a period'

def testDuration(self):

    events = (((2013, 1, 1, 0, 0, 0), (2013, 1, 31, 0, 0, 0), 31), ((2013, 3, 1, 0, 0, 0), (2013, 4, 2, 0, 0, 0), 33), ((2013, 3, 8, 0, 0, 0), (2013, 8, 5, 0, 0, 0), 116), ((2013, 5, 1, 0, 0, 0), (2013, 9, 21, 0, 0, 0), 62), ((2013, 5, 1, 0, 0, 0), (2013, 5, 5, 0, 0, 0), 5), ((2013, 8, 5, 0, 0, 0), (2013, 9, 16, 0, 0, 0), 0))
    period = self.period
    for (index, event) in enumerate(events):
        (start, end, expected_duration) = event
        tp_event = S3TimeSeriesEvent(index, start=tp_datetime(*start), end=tp_datetime(*end))
        duration = period.duration(tp_event, 'days')
        self.assertEqual(duration, expected_duration, msg=('Incorrect    result    for    duration    of    event    %s:    %s    !=    %s.' % ((index + 1), duration, expected_duration)))
