'Test that references from %run are cleared by xdel.'

def test_xdel(self):

    src = 'class    A(object):\n                monitor    =    []\n                def    __del__(self):\n                                self.monitor.append(1)\na    =    A()\n'
    self.mktmp(src)
    _ip.magic(('run    %s' % self.fname))
    _ip.run_cell('a')
    monitor = _ip.user_ns['A'].monitor
    nt.assert_equal(monitor, [])
    _ip.magic('xdel    a')
    nt.assert_equal(monitor, [1])
