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

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

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

        script_obj = script.Script(self.hass, [
            {'event': event},
            {'delay': {'seconds': 5}},
            {'event': event}])

        script_obj.run()

        self.hass.pool.block_till_done()

        assert script_obj.is_running
        assert script_obj.can_cancel
        assert script_obj.last_action == event
        assert len(events) == 1

        future = dt_util.utcnow() + timedelta(seconds=5)
        fire_time_changed(self.hass, future)
        self.hass.pool.block_till_done()

        assert not script_obj.is_running
        assert len(events) == 2
Compute the loss of prediction ``pred`` and ``y``.
dataset/ETHPy150Open home-assistant/home-assistant/tests/helpers/test_script.py/TestScriptHelper.test_delay--crossover with--dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/ensemble/gradient_boosting.py/LossFunction.__call__