from unittest import TestCase, main

import numpy as np
import numpy.testing as npt

from nimble import Events


class TestClassIterable(TestCase):
    def setUp(self):
        conditional_array = np.array([0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1])
        condition = (conditional_array > 0)
        self.events = Events(condition, sample_period=0.5, )

    def test_start_stop_loc(self):
        test_starts = []
        test_stops = []

        for event in self.events:
            test_starts.append(event.start)
            test_stops.append(event.stop)

        npt.assert_array_equal(self.events.starts, test_starts)
        npt.assert_array_equal(self.events.stops, test_stops)

    def test_durations(self):
        validation_durations = [1.5, 1, 1]
        test_durations = []
        for event in self.events:
            test_durations.append(event.duration)

        npt.assert_array_equal(validation_durations, test_durations)

    def test_index(self):
        validation_index = [0, 1, 2]
        test_index = []
        for event in self.events:
            test_index.append(event.i)

        npt.assert_array_equal(validation_index, test_index)

if __name__ == '__main__':
    main()

@@ -499,16 +499,17 @@
 d(event.
+i
 start)%0A 
@@ -543,16 +543,17 @@
 d(event.
+i
 stop)%0A%0A 
@@ -586,26 +586,18 @@
 ual(
-self.events.starts
+%5B1, 7, 10%5D
 , te
@@ -642,25 +642,18 @@
 ual(
-self.events.stops
+%5B3, 8, 11%5D
 , te
@@ -838,16 +838,17 @@
 d(event.
+i
 duration

Update unit test_iterable_event.py to handle new logic