'Regression test for https://aeon.stsci.edu/ssb/trac/pyfits/ticket/157
Tests that "Nonstandard" HDUs with SIMPLE = F are read and written
without prepending a superfluous and unwanted standard primary HDU.'

def test_nonstandard_hdu(self):

    data = np.arange(100, dtype=np.uint8)
    hdu = fits.PrimaryHDU(data=data)
    hdu.header['SIMPLE'] = False
    hdu.writeto(self.temp('test.fits'))
    info = [(0, '', 1, 'NonstandardHDU', 5, (), '', '')]
    with fits.open(self.temp('test.fits')) as hdul:
        assert (hdul.info(output=False) == info)
        assert (hdul[0].data[:100] == data).all()
        assert (hdul[0].data[100:] == 0).all()
