'Test getting/setting the EXTNAME of an HDU.'

def test_extname(self):

    h1 = fits.PrimaryHDU()
    assert (h1.name == 'PRIMARY')
    assert ('EXTNAME' not in h1.header)
    h1.name = 'NOTREAL'
    assert (h1.name == 'NOTREAL')
    assert (h1.header.get('EXTNAME') == 'NOTREAL')
    h1.header['EXTNAME'] = 'TOOREAL'
    assert (h1.name == 'TOOREAL')
    del h1.header['EXTNAME']
    assert (h1.name == 'PRIMARY')
    h2 = fits.ImageHDU()
    assert (h2.name == '')
    assert ('EXTNAME' not in h2.header)
    h2.name = 'HELLO'
    assert (h2.name == 'HELLO')
    assert (h2.header.get('EXTNAME') == 'HELLO')
    h2.header['EXTNAME'] = 'GOODBYE'
    assert (h2.name == 'GOODBYE')
