'Regression test for
https://github.com/spacetelescope/PyFITS/issues/7
Assures that HIERARCH keywords with lower-case characters and other
normally invalid keyword characters are not considered invalid.'

def test_verify_mixed_case_hierarch(self):

    c = fits.Card('HIERARCH    WeirdCard.~!@#_^$%&', 'The    value', 'a    comment')
    c.verify('exception')
    assert (c.keyword == 'WeirdCard.~!@#_^$%&')
    assert (c.value == 'The    value')
    assert (c.comment == 'a    comment')
    header = fits.Header([('simple', True), ('BITPIX', 8), ('NAXIS', 0), ('EXTEND', True, 'May    contain    datasets'), ('HIERARCH    key.META_0', 'detRow')])
    hdu = fits.PrimaryHDU(header=header)
    hdu.writeto(self.temp('test.fits'))
    with fits.open(self.temp('test.fits')) as hdul:
        header2 = hdul[0].header
        assert (str(header.cards[header.index('key.META_0')]) == str(header2.cards[header2.index('key.META_0')]))
