Skip to content

Commit c3d9ebc

Browse files
committed
Add test reproducing astropy#8660
1 parent 8a59b16 commit c3d9ebc

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎astropy/io/fits/tests/test_convenience.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,17 @@ def test_append_filehandle(self, tmpdir, mode):
187187
append_file = tmpdir.join('append.fits')
188188
with append_file.open(mode) as handle:
189189
fits.append(filename=handle, data=np.ones((4, 4)))
190+
191+
def test_append_with_header(self):
192+
"""
193+
Test fits.append with a fits Header, which triggers detection of the
194+
HDU class. Regression test for
195+
https://github.com/astropy/astropy/issues/8660
196+
"""
197+
testfile = self.temp('test_append_1.fits')
198+
with fits.open(self.data('test0.fits')) as hdus:
199+
for hdu in hdus:
200+
fits.append(testfile, hdu.data, hdu.header, checksum=True)
201+
202+
with fits.open(testfile, checksum=True) as hdus:
203+
assert len(hdus) == 5

0 commit comments

Comments
 (0)