'Basic test for creating GroupData from scratch.'

def test_create_groupdata(self):

    imdata = np.arange(100.0)
    imdata.shape = (10, 1, 1, 2, 5)
    pdata1 = (np.arange(10, dtype=np.float32) + 0.1)
    pdata2 = 42.0
    x = fits.hdu.groups.GroupData(imdata, parnames=['abc', 'xyz'], pardata=[pdata1, pdata2], bitpix=(-32))
    assert (x.parnames == ['abc', 'xyz'])
    assert (x.par('abc') == pdata1).all()
    assert (x.par('xyz') == ([pdata2] * len(x))).all()
    assert (x.data == imdata).all()
    ghdu = fits.GroupsHDU(data=x)
    ghdu.writeto(self.temp('test.fits'))
    with fits.open(self.temp('test.fits')) as h:
        hdr = h[0].header
        assert (hdr['GCOUNT'] == 10)
        assert (hdr['PCOUNT'] == 2)
        assert (hdr['NAXIS'] == 5)
        assert (hdr['NAXIS1'] == 0)
        assert (hdr['NAXIS2'] == 5)
        assert (hdr['NAXIS3'] == 2)
        assert (hdr['NAXIS4'] == 1)
        assert (hdr['NAXIS5'] == 1)
        assert (h[0].data.parnames == ['abc', 'xyz'])
        assert comparerecords(h[0].data, x)
