File: test_empty_slice.py

package info (click to toggle)
python-fitsio 1.2.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,200 kB
  • sloc: ansic: 9,410; python: 5,802; makefile: 9
file content (21 lines) | stat: -rw-r--r-- 510 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)

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

        with FITS(fname) as fits:
            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