'Make sure invalid keys in the \'in\' operator return False.
Regression test for https://github.com/astropy/astropy/issues/5583'

def test_invalid_hdu_key_in_contains(self):

    hdulist = fits.HDUList(fits.PrimaryHDU())
    hdulist.append(fits.ImageHDU())
    hdulist.append(fits.ImageHDU())
    bad_keys = [None, 3.5, {}]
    for key in bad_keys:
        assert (not (key in hdulist))
