'Test getting/setting the EXTVER and EXTLEVEL of and HDU.'

def test_extver_extlevel(self):

    h1 = fits.PrimaryHDU()
    assert (h1.ver == 1)
    assert (h1.level == 1)
    assert ('EXTVER' not in h1.header)
    assert ('EXTLEVEL' not in h1.header)
    h1.ver = 2
    assert (h1.header.get('EXTVER') == 2)
    h1.header['EXTVER'] = 3
    assert (h1.ver == 3)
    del h1.header['EXTVER']
    (h1.ver == 1)
    h1.level = 2
    assert (h1.header.get('EXTLEVEL') == 2)
    h1.header['EXTLEVEL'] = 3
    assert (h1.level == 3)
    del h1.header['EXTLEVEL']
    assert (h1.level == 1)
    pytest.raises(TypeError, setattr, h1, 'ver', 'FOO')
    pytest.raises(TypeError, setattr, h1, 'level', 'BAR')
