def test_condition(self):
        event = 'test_event'
        events = []

        def record_event(event):
            """Add recorded event to set."""
            events.append(event)

        self.hass.bus.listen(event, record_event)

        self.hass.states.set('test.entity', 'hello')

        script_obj = script.Script(self.hass, [
            {'event': event},
            {
                'condition': 'state',
                'entity_id': 'test.entity',
                'state': 'hello',
            },
            {'event': event},
        ])

        script_obj.run()
        self.hass.pool.block_till_done()
        assert len(events) == 2

        self.hass.states.set('test.entity', 'goodbye')

        script_obj.run()
        self.hass.pool.block_till_done()
        assert len(events) == 3
Test if we can use conditions in a script.
dataset/ETHPy150Open home-assistant/home-assistant/tests/helpers/test_script.py/TestScriptHelper.test_condition