'Test simple function (executor) and unsub.'

def test_simple_function_unsub(self):

    calls1 = []
    calls2 = []
    def test_funct1(data):
        'Test    function.'
        calls1.append(data)
    def test_funct2(data):
        'Test    function.'
        calls2.append(data)
    dispatcher_connect(self.hass, 'test1', test_funct1)
    unsub = dispatcher_connect(self.hass, 'test2', test_funct2)
    dispatcher_send(self.hass, 'test1', 3)
    dispatcher_send(self.hass, 'test2', 4)
    self.hass.block_till_done()
    assert (calls1 == [3])
    assert (calls2 == [4])
    unsub()
    dispatcher_send(self.hass, 'test1', 5)
    dispatcher_send(self.hass, 'test2', 6)
    self.hass.block_till_done()
    assert (calls1 == [3, 5])
    assert (calls2 == [4])
    unsub()
    dispatcher_send(self.hass, 'test1', 7)
    dispatcher_send(self.hass, 'test2', 8)
    self.hass.block_till_done()
    assert (calls1 == [3, 5, 7])
    assert (calls2 == [4])
