'Test deleting old states.'

def test_purge_old_states(self):

    self._add_test_states()
    with session_scope(hass=self.hass) as session:
        states = session.query(States)
        self.assertEqual(states.count(), 5)
        purge_old_data(self.hass.data[DATA_INSTANCE], 4)
        self.assertEqual(states.count(), 2)
