Skip to content

Commit

Permalink
more empty slice tests, update change log
Browse files Browse the repository at this point in the history
  • Loading branch information
esheldon committed Jun 11, 2024
1 parent e05f3b6 commit 5899be0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
version 1.2.3 (not yet released)
-------------

Bug Fixes

- Reading images with empty slices was returning data

version 1.2.2
-------------

Expand Down
2 changes: 1 addition & 1 deletion fitsio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
usage.
"""

__version__ = '1.2.2'
__version__ = '1.2.3'

from . import fitslib

Expand Down
12 changes: 7 additions & 5 deletions fitsio/tests/test_empty_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@


def test_empty_image_slice():

shape = (10, 10)
data = np.arange(shape[0] * shape[1]).reshape(shape)

with tempfile.TemporaryDirectory() as tmpdir:
fname = os.path.join(tmpdir, 'test.fits')
write(fname, data, clobber=True)

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

assert fits[0][0:8, 0:0].size == 0

assert fits[0][0:0, 0:8].size == 0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def check_system_cfitsio_objects(self, obj_name):

setup(
name="fitsio",
version="1.2.2",
version="1.2.3",
description=description,
long_description=long_description,
long_description_content_type='text/markdown; charset=UTF-8; variant=GFM',
Expand Down

0 comments on commit 5899be0

Please sign in to comment.