'Regression test for https://aeon.stsci.edu/ssb/trac/pyfits/ticket/154
Make sure that when a Header is read from a text file that the END card
is ignored.'

def test_header_fromtextfile_with_end_card(self):

    header = fits.Header([('A', 'B', 'C'), ('D', 'E', 'F')])
    with open(self.temp('test.hdr'), 'w') as f:
        f.write('\n'.join((str(c).strip() for c in header.cards)))
        f.write('\nEND')
    new_header = fits.Header.fromtextfile(self.temp('test.hdr'))
    assert ('END' not in new_header)
    assert (header == new_header)
