def test_extver_extlevel(self):

        # EXTVER and EXTNAME work exactly the same; their semantics are, for
        # now, to be inferred by the user.  Although they should never be less
        # than 1, the standard does not explicitly forbid any value so long as
        # it's an integer
        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

        assert_raises(TypeError, setattr, h1, 'ver', 'FOO')
        assert_raises(TypeError, setattr, h1, 'level', 'BAR')
Test getting/setting the EXTVER and EXTLEVEL of and HDU.
dataset/ETHPy150Open spacetelescope/PyFITS/pyfits/tests/test_core.py/TestCore.test_extver_extlevel