'Tests the basic functionality of the `fitsheader` script.'

def test_fitsheader_script(self):

    from ....io.fits.scripts import fitsheader
    hf = fitsheader.HeaderFormatter(self.data('zerowidth.fits'))
    output = hf.parse(extensions=['AIPS    FQ'])
    assert ("EXTNAME    =    'AIPS    FQ" in output)
    assert ('BITPIX' in output)
    output = hf.parse(extensions=['AIPS    FQ'], keywords=['EXTNAME'])
    assert ("EXTNAME    =    'AIPS    FQ" in output)
    assert ('BITPIX        =' not in output)
    assert (len(output.split('\n')) == 3)
    output = hf.parse(extensions=[1], keywords=['EXTNAME', 'BITPIX'])
    assert ('EXTNAME    =' in output)
    assert ('BITPIX        =' in output)
    assert (len(output.split('\n')) == 4)
    output = hf.parse(extensions=[1], keywords=['NAXIS*'])
    assert ('NAXIS            =' in output)
    assert ('NAXIS1        =' in output)
    assert ('NAXIS2        =' in output)
    hf = fitsheader.HeaderFormatter(self.data('test0.fits'))
    assert ("EXTNAME    =    'SCI" in hf.parse(extensions=['SCI,2']))
    hf = fitsheader.HeaderFormatter(self.data('comp.fits'))
    assert ("XTENSION=    'IMAGE" in hf.parse(extensions=[1], compressed=False))
    assert ("XTENSION=    'BINTABLE" in hf.parse(extensions=[1], compressed=True))
