-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test case fitsio/tests/test_empty_slice.py
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |