'Test if source is a sensor.'

def test_binary_sensor_source(self):

    values = [1, 0, 1, 0, 1, 0, 1]
    assert setup_component(self.hass, 'sensor', {'sensor': {'platform': 'statistics', 'name': 'test', 'entity_id': 'binary_sensor.test_monitored'}})
    for value in values:
        self.hass.states.set('binary_sensor.test_monitored', value)
        self.hass.block_till_done()
    state = self.hass.states.get('sensor.test_count')
    self.assertEqual(str(len(values)), state.state)
