'testConstructorNameArg
Passing name=\'...\' to the BinTableHDU and TableHDU constructors
should set the .name attribute and \'EXTNAME\' header keyword, and
override any name in an existing \'EXTNAME\' value.'

def test_constructor_name_arg(self):

    for hducls in [fits.BinTableHDU, fits.TableHDU]:
        hdu = hducls()
        assert (hdu.name == '')
        assert ('EXTNAME' not in hdu.header)
        hdu.name = 'FOO'
        assert (hdu.name == 'FOO')
        assert (hdu.header['EXTNAME'] == 'FOO')
        hdu = hducls(name='FOO')
        assert (hdu.name == 'FOO')
        assert (hdu.header['EXTNAME'] == 'FOO')
        hdr = fits.Header()
        hdr['EXTNAME'] = 'EVENTS'
        hdu = hducls(header=hdr, name='FOO')
        assert (hdu.name == 'FOO')
        assert (hdu.header['EXTNAME'] == 'FOO')
