'This is a test of the column attribute change notification system.
After a column has been removed from a table (but other references
are kept to that same column) changes to that column\'s attributes
should not trigger a notification on the table it was removed from.'

def test_column_attribute_change_after_removal(self):

    table = fits.BinTableHDU.from_columns([fits.Column('a', format='D'), fits.Column('b', format='D')])
    b = table.columns['b']
    table.columns.del_col('b')
    assert (table.data.dtype.names == ('a',))
    b.name = 'HELLO'
    assert (b.name == 'HELLO')
    assert ('TTYPE2' not in table.header)
    assert (table.header['TTYPE1'] == 'a')
    assert (table.columns.names == ['a'])
    with pytest.raises(KeyError):
        table.columns['b']
    table.columns.change_name('a', 'GOODBYE')
    with pytest.raises(KeyError):
        table.columns['a']
    assert (table.columns['GOODBYE'].name == 'GOODBYE')
    assert (table.data.dtype.names == ('GOODBYE',))
    assert (table.columns.names == ['GOODBYE'])
    assert (table.data.columns.names == ['GOODBYE'])
    table.columns['GOODBYE'].name = 'foo'
    with pytest.raises(KeyError):
        table.columns['GOODBYE']
    assert (table.columns['foo'].name == 'foo')
    assert (table.data.dtype.names == ('foo',))
    assert (table.columns.names == ['foo'])
    assert (table.data.columns.names == ['foo'])
