Skip to content

Commit

Permalink
add test case fitsio/tests/test_empty_slice.py
Browse files Browse the repository at this point in the history
  • Loading branch information
esheldon committed Jun 11, 2024
1 parent d621316 commit 8ccb4db
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions fitsio/tests/test_empty_slice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import tempfile
import os
import numpy as np
from ..fitslib import write, FITS


def test_empty_image_slice():
shape = (10, 10)
data = np.arange(shape[0] * shape[1]).reshape(shape)
outfile = 'test_image.fits'
with tempfile.TemporaryDirectory() as tmpdir:
fname = os.path.join(tmpdir, 'test.fits')
write(fname, data, clobber=True)

# third, test slices using fitsio
with FITS(outfile) as fits:
# first, passing the slices directly
# overlap = f[0][xslice, yslice]
overlap = fits[0][0:8, 0:0]
assert overlap.size == 0

0 comments on commit 8ccb4db

Please sign in to comment.