'Tests support for multiple parameters of the same name, and ensures
that the data in duplicate parameters are returned as a single summed
value.'

def test_duplicate_parameter(self):

    imdata = np.arange(100.0)
    imdata.shape = (10, 1, 1, 2, 5)
    pdata1 = (np.arange(10, dtype=np.float32) + 1)
    pdata2 = 42.0
    x = fits.hdu.groups.GroupData(imdata, parnames=['abc', 'xyz', 'abc'], pardata=[pdata1, pdata2, pdata1], bitpix=(-32))
    assert (x.parnames == ['abc', 'xyz', 'abc'])
    assert (x.par('abc') == (pdata1 * 2)).all()
    assert (x[0].par('abc') == 2)
    x[0].setpar(0, 2)
    assert (x[0].par('abc') == 3)
    pytest.raises(ValueError, x[0].setpar, 'abc', 2)
    x[0].setpar('abc', (2, 3))
    assert (x[0].par('abc') == 5)
    assert (x.par('abc')[0] == 5)
    assert (x.par('abc')[1:] == (pdata1[1:] * 2)).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['PCOUNT'] == 3)
        assert (hdr['PTYPE1'] == 'abc')
        assert (hdr['PTYPE2'] == 'xyz')
        assert (hdr['PTYPE3'] == 'abc')
        assert (x.parnames == ['abc', 'xyz', 'abc'])
        assert (x.dtype.names == ('abc', 'xyz', '_abc', 'DATA'))
        assert (x.par('abc')[0] == 5)
        assert (x.par('abc')[1:] == (pdata1[1:] * 2)).all()
