def test_if_action(self):
        """"Test if action."""
        entity_id = 'domain.test_entity'
        test_state = 10
        assert _setup_component(self.hass, automation.DOMAIN, {
            automation.DOMAIN: {
                'trigger': {
                    'platform': 'event',
                    'event_type': 'test_event',
                },
                'condition': {
                    'platform': 'numeric_state',
                    'entity_id': entity_id,
                    'above': test_state,
                    'below': test_state + 2
                },
                'action': {
                    'service': 'test.automation'
                }
            }
        })

        self.hass.states.set(entity_id, test_state)
        self.hass.bus.fire('test_event')
        self.hass.pool.block_till_done()

        self.assertEqual(1, len(self.calls))

        self.hass.states.set(entity_id, test_state - 1)
        self.hass.bus.fire('test_event')
        self.hass.pool.block_till_done()

        self.assertEqual(1, len(self.calls))

        self.hass.states.set(entity_id, test_state + 1)
        self.hass.bus.fire('test_event')
        self.hass.pool.block_till_done()

        self.assertEqual(2, len(self.calls))
dataset/ETHPy150Open home-assistant/home-assistant/tests/components/automation/test_numeric_state.py/TestAutomationNumericState.test_if_action/original