'Test handling of `__file__` attribute in `%run <file.ipy>`.'

def test_run_ipy_file_attribute(self):

    src = 't    =    __file__\n'
    self.mktmp(src, ext='.ipy')
    _missing = object()
    file1 = _ip.user_ns.get('__file__', _missing)
    _ip.magic(('run    %s' % self.fname))
    file2 = _ip.user_ns.get('__file__', _missing)
    nt.assert_equal(_ip.user_ns['t'], self.fname)
    nt.assert_equal(file1, file2)
