'Test that accessing a non-existent keyword raises a KeyError.'

def test_missing_keyword(self):

    header = fits.Header()
    pytest.raises(KeyError, (lambda k: header[k]), 'NAXIS')
    try:
        header['NAXIS']
    except KeyError as e:
        assert (e.args[0] == "Keyword    'NAXIS'    not    found.")
