import numpy as np
import numpy.testing as npt
from nimble.core.event_detection import Event
from unittest import TestCase


class TestEventDetection(TestCase):
    def test_default_parameters(self):
        """
        Test event detection with only a supplied condition
        """
        np.random.seed(10)
        validation_array = np.random.random_integers(0, 1, 100)
        condition = (validation_array > 0)
        events = Event(condition)
        
        npt.assert_array_equal(validation_array, events.as_array)
        
    def test_no_events_found(self):
        """
        Test arrays that have no active events
        """
        conditional_array = np.ones(10, dtype='i1') * 5
        validation_array = np.zeros(10, dtype='i1') 
        condition = (conditional_array > 5)
        events = Event(condition)
        
        npt.assert_array_equal(validation_array, events.as_array)

    def test_event_always_active(self):
        """
        Test arrays that has an event active throughout entire array
        """
        validation_array = np.ones(10, dtype='i1')
        condition = (validation_array > 0)
        events = Event(condition)
        
        npt.assert_array_equal(validation_array, events.as_array)

    def test_array_with_event_active_at_start(self):
        """
        Test arrays that have events active at the start
        """
        validation_array = np.zeros(10, dtype='i1')
        validation_array[:1] = 1
        condition = (validation_array > 0)
        
        events = Event(condition)
        npt.assert_array_equal(validation_array, events.as_array)

    def test_array_with_event_active_at_end(self):
        """
        Test arrays that have events active at the end
        """
        validation_array = np.zeros(10, dtype='i1')
        validation_array[-1:] = 1
        condition = (validation_array > 0)
        
        events = Event(condition)
        npt.assert_array_equal(validation_array, events.as_array)

    #def test_event_entry_debounce(self):
    #def test_event_exit_debounce(self):
    #def test_entry_and_exit_debounce(self):
    #def test_min_event_window_length(self):
    #def test_max_event_window_length(self):
@@ -1977,25 +1977,24 @@
 array)%0A%0A    
-#
 def test_eve
@@ -2026,89 +2026,1060 @@
     
-#def test_event_exit_debounce(self):%0A    #def test_entry_and_exit_debounce(self):
+    conditional_array = np.array(%5B0, 1, 1, 1, 0, 0, 0, 1, 1, 0%5D)%0A        validation_array = np.array(%5B0, 1, 1, 1, 0, 0, 0, 0, 0, 0%5D)%0A        %0A        condition = (conditional_array %3E 0)%0A        events = Event(condition, entry_debounce=3)%0A        npt.assert_array_equal(validation_array, events.as_array)%0A        %0A    def test_event_exit_debounce(self):%0A        conditional_array = np.array(%5B0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1%5D)%0A        validation_array = np.array(%5B0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1%5D)%0A        %0A        condition = (conditional_array %3E 0)%0A        events = Event(condition, exit_debounce=2)%0A        npt.assert_array_equal(validation_array, events.as_array)%0A%0A    def test_entry_and_exit_debounce(self):%0A        conditional_array = np.array(%5B0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1%5D)%0A        validation_array = np.array(%5B0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1%5D)%0A        %0A        condition = (conditional_array %3E 0)%0A        events = Event(condition, entry_debounce=2, exit_debounce=2)%0A        npt.assert_array_equal(validation_array, events.as_array)%0A    
 %0A   

Create unit tests for event detection debouncing.