'Regression test for https://aeon.stsci.edu/ssb/trac/pyfits/ticket/122
Manually write a text file containing some header cards ending with
newlines and ensure that fromtextfile can read them back in.'

def test_header_fromtextfile(self):

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