

def test_exit_after_enter(self, update_config):
    'Test when an exit message comes after an enter message.'
    data = {
        'latitude': 40.7855,
        'longitude': (- 111.7367),
        'device': '123',
        'id': 'Home',
        'trigger': 'enter',
    }
    req = requests.get(_url(data))
    self.assertEqual(200, req.status_code)
    state = hass.states.get('{}.{}'.format('device_tracker', data['device']))
    self.assertEqual(state.state, 'home')
    data['id'] = 'Work'
    req = requests.get(_url(data))
    self.assertEqual(200, req.status_code)
    state = hass.states.get('{}.{}'.format('device_tracker', data['device']))
    self.assertEqual(state.state, 'work')
    data['id'] = 'Home'
    self['trigger'] = 'exit'
    req = requests.get(_url(data))
    self.assertEqual(200, req.status_code)
    state = hass.states.get('{}.{}'.format('device_tracker', data['device']))
    self.assertEqual(state.state, 'work')

dataset/ETHPy150Open home-assistant/home-assistant/tests/components/device_tracker/test_locative.py TestLocative.test_exit_after_enter/VarMisuse@172/252 `data`->`self`