Skip to content

tests failing with numpy-1.10 #4247

Closed
Closed

Description

@jlec
==================================================================== test session starts ====================================================================
platform linux -- Python 3.4.3 -- py-1.4.30 -- pytest-2.7.3 -- /usr/bin/python3.4
/usr/lib64/python3.4/importlib/_bootstrap.py:321: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility
  return f(*args, **kwds)
rootdir: /var/tmp/portage/dev-python/astropy-1.0.5/work/astropy-1.0.5, inifile: setup.cfg
plugins: cov, pythonpath, catchlog

Running tests with Astropy version 1.0.5.
Running tests in astropy/io/fits/tests/test_checksum.py astropy/io/fits/tests/test_connect.py.

Platform: Linux-4.1.9-lh-x86_64-Intel-R-_Core-TM-_i7-2600_CPU_@_3.40GHz-with-gentoo-2.2

Executable: /usr/bin/python3.4

Full Python Version: 
3.4.3 (default, Aug 21 2015, 10:51:23) 
[GCC 4.9.3]

encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8
byteorder: little
float info: dig: 15, mant_dig: 15

Numpy: 1.10.1
Scipy: 0.16.0
Matplotlib: 1.4.3
h5py: 2.5.0

collected 46 items 

astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_sample_file PASSED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_image_create PASSED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_nonstandard_checksum PASSED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_scaled_data PASSED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_scaled_data_auto_rescale PASSED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_uint16_data PASSED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_groups_hdu_data FAILED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_binary_table_data FAILED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_variable_length_table_data FAILED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_ascii_table_data PASSED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_compressed_image_data PASSED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_compressed_image_data_int16 FAILED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_compressed_image_data_float32 /usr/lib64/python3.4/site-packages/py/_code/source.py:348: ResourceWarning: unclosed file <_io.FileIO name='/tmp/.private/justin/fits-test-v3agys4z/tmp.fits' mode='wb'>
  astnode = compile(content, "source", "exec", 1024)  # 1024 for AST
/usr/lib64/python3.4/site-packages/py/_code/source.py:348: ResourceWarning: unclosed file <_io.FileIO name='/tmp/.private/justin/fits-test-36tp_7at/tmp.fits' mode='wb'>
  astnode = compile(content, "source", "exec", 1024)  # 1024 for AST
FAILED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_open_with_no_keywords PASSED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_append PASSED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_writeto_convenience PASSED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_hdu_writeto PASSED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_hdu_writeto_existing PASSED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_datasum_only PASSED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_open_update_mode_preserve_checksum PASSED
astropy/io/fits/tests/test_checksum.py::TestChecksumFunctions::test_open_update_mode_update_checksum FAILED
astropy/io/fits/tests/test_connect.py::TestSingleTable::test_simple PASSED
astropy/io/fits/tests/test_connect.py::TestSingleTable::test_simple_meta PASSED
astropy/io/fits/tests/test_connect.py::TestSingleTable::test_simple_meta_conflicting PASSED
astropy/io/fits/tests/test_connect.py::TestSingleTable::test_simple_noextension PASSED
astropy/io/fits/tests/test_connect.py::TestSingleTable::test_with_units PASSED
astropy/io/fits/tests/test_connect.py::TestSingleTable::test_masked PASSED
astropy/io/fits/tests/test_connect.py::TestSingleTable::test_masked_nan PASSED
astropy/io/fits/tests/test_connect.py::TestSingleTable::test_read_from_fileobj FAILED
astropy/io/fits/tests/test_connect.py::TestSingleTable::test_read_with_nonstandard_units PASSED
astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read FAILED
astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read_with_hdu_0 PASSED
astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read_with_hdu_1[1] FAILED
astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read_with_hdu_1[first] FAILED
astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read_with_hdu_2[2] PASSED
astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read_with_hdu_2[second] PASSED
astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read_from_hdulist PASSED
astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read_from_hdulist_with_hdu_0 PASSED
astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read_from_hdulist_with_hdu_1[1] PASSED
astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read_from_hdulist_with_hdu_1[first] PASSED
astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read_from_hdulist_with_hdu_2[2] PASSED
astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read_from_hdulist_with_hdu_2[second] PASSED
astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read_from_single_hdu PASSED
astropy/io/fits/tests/test_connect.py::test_masking_regression_1795 PASSED
astropy/io/fits/tests/test_connect.py::test_scale_error PASSED
astropy/io/fits/tests/test_connect.py::test_bool_column PASSED

========================================================================= FAILURES ==========================================================================
________________________________________________________ TestChecksumFunctions.test_groups_hdu_data _________________________________________________________

self = <astropy.io.fits.tests.test_checksum.TestChecksumFunctions object at 0x2b5c640f48d0>

    def test_groups_hdu_data(self):
        imdata = np.arange(100.0)
        imdata.shape = (10, 1, 1, 2, 5)
        pdata1 = np.arange(10) + 0.1
        pdata2 = 42
        x = fits.hdu.groups.GroupData(imdata, parnames=[str('abc'), str('xyz')],
                                      pardata=[pdata1, pdata2], bitpix=-32)
        hdu = fits.GroupsHDU(x)
>       hdu.writeto(self.temp('tmp.fits'), clobber=True, checksum=True)

astropy/io/fits/tests/test_checksum.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
astropy/io/fits/hdu/base.py:450: in writeto
    checksum=checksum)
astropy/io/fits/hdu/hdulist.py:680: in writeto
    hdu._prewriteto(checksum=checksum)
astropy/io/fits/hdu/image.py:539: in _prewriteto
    return super(_ImageBaseHDU, self)._prewriteto(checksum, inplace)
astropy/io/fits/hdu/base.py:568: in _prewriteto
    self._update_checksum(checksum)
astropy/io/fits/hdu/base.py:625: in _update_checksum
    datasum_keyword=datasum_keyword)
astropy/io/fits/hdu/base.py:1403: in add_checksum
    datasum_keyword=datasum_keyword)
astropy/io/fits/hdu/base.py:1353: in add_datasum
    cs = self._calculate_datasum(blocking)
astropy/io/fits/hdu/groups.py:530: in _calculate_datasum
    blocking=blocking)
astropy/io/fits/hdu/base.py:1609: in _compute_checksum
    sum32 = self._compute_hdu_checksum(data[i:i + length], sum32)
astropy/io/fits/hdu/groups.py:211: in __getitem__
    out = super(GroupData, self).__getitem__(key)
astropy/io/fits/fitsrec.py:486: in __getitem__
    out = self.view(np.recarray).__getitem__(key).view(subtype)
astropy/io/fits/hdu/groups.py:204: in __array_finalize__
    super(GroupData, self).__array_finalize__(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("recarray has no attribute _nfields") raised in repr()] GroupData object at 0x2b5c640e46d8>
obj = array([ 61, 204, 204, 205,  66,  40,   0,   0,   0,   0,   0,   0,  63,
       128,   0,   0,  64,   0,   0,   0,  64,...66, 190,   0,   0,  66, 192,   0,   0,
        66, 194,   0,   0,  66, 196,   0,   0,  66, 198,   0,   0], dtype=uint8)

    def __array_finalize__(self, obj):
        if obj is None:
            return

        if isinstance(obj, FITS_rec):
            self._converted = obj._converted
            self._heapoffset = obj._heapoffset
            self._heapsize = obj._heapsize
            self._coldefs = obj._coldefs
            self._nfields = obj._nfields
            self._gap = obj._gap
            self._uint = obj._uint
        else:
            # This will allow regular ndarrays with fields, rather than
            # just other FITS_rec objects
>           self._nfields = len(obj.dtype.names)
E           TypeError: object of type 'NoneType' has no len()

astropy/io/fits/fitsrec.py:249: TypeError
_______________________________________________________ TestChecksumFunctions.test_binary_table_data ________________________________________________________

self = <astropy.io.fits.tests.test_checksum.TestChecksumFunctions object at 0x2b5c5f5b9080>

    def test_binary_table_data(self):
        a1 = np.array(['NGC1001', 'NGC1002', 'NGC1003'])
        a2 = np.array([11.1, 12.3, 15.2])
        col1 = fits.Column(name='target', format='20A', array=a1)
        col2 = fits.Column(name='V_mag', format='E', array=a2)
        cols = fits.ColDefs([col1, col2])
        tbhdu = fits.BinTableHDU.from_columns(cols)
>       tbhdu.writeto(self.temp('tmp.fits'), clobber=True, checksum=True)

astropy/io/fits/tests/test_checksum.py:171: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
astropy/io/fits/hdu/base.py:1754: in writeto
    checksum=checksum)
astropy/io/fits/hdu/hdulist.py:680: in writeto
    hdu._prewriteto(checksum=checksum)
astropy/io/fits/hdu/table.py:527: in _prewriteto
    return super(_TableBaseHDU, self)._prewriteto(checksum, inplace)
astropy/io/fits/hdu/base.py:568: in _prewriteto
    self._update_checksum(checksum)
astropy/io/fits/hdu/base.py:625: in _update_checksum
    datasum_keyword=datasum_keyword)
astropy/io/fits/hdu/base.py:1403: in add_checksum
    datasum_keyword=datasum_keyword)
astropy/io/fits/hdu/base.py:1353: in add_datasum
    cs = self._calculate_datasum(blocking)
astropy/io/fits/hdu/table.py:834: in _calculate_datasum
    return self._calculate_datasum_with_heap(blocking)
astropy/io/fits/hdu/table.py:804: in _calculate_datasum_with_heap
    csum = self._compute_checksum(dout, blocking=blocking)
astropy/io/fits/hdu/base.py:1609: in _compute_checksum
    sum32 = self._compute_hdu_checksum(data[i:i + length], sum32)
astropy/io/fits/fitsrec.py:486: in __getitem__
    out = self.view(np.recarray).__getitem__(key).view(subtype)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("recarray has no attribute _nfields") raised in repr()] FITS_rec object at 0x2b5c64a90908>
obj = array([ 78,  71,  67,  49,  48,  48,  49,   0,   0,   0,   0,   0,   0,
         0,   0,   0,   0,   0,   0,   0, 154,...48,  48,  51,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
         0,   0,   0,  51,  51, 115,  65], dtype=uint8)

    def __array_finalize__(self, obj):
        if obj is None:
            return

        if isinstance(obj, FITS_rec):
            self._converted = obj._converted
            self._heapoffset = obj._heapoffset
            self._heapsize = obj._heapsize
            self._coldefs = obj._coldefs
            self._nfields = obj._nfields
            self._gap = obj._gap
            self._uint = obj._uint
        else:
            # This will allow regular ndarrays with fields, rather than
            # just other FITS_rec objects
>           self._nfields = len(obj.dtype.names)
E           TypeError: object of type 'NoneType' has no len()

astropy/io/fits/fitsrec.py:249: TypeError
___________________________________________________ TestChecksumFunctions.test_variable_length_table_data ___________________________________________________

self = <astropy.io.fits.tests.test_checksum.TestChecksumFunctions object at 0x2b5c64bef080>

    def test_variable_length_table_data(self):
        c1 = fits.Column(name='var', format='PJ()',
                         array=np.array([[45.0, 56], np.array([11, 12, 13])],
                         'O'))
        c2 = fits.Column(name='xyz', format='2I', array=[[11, 3], [12, 4]])
        tbhdu = fits.BinTableHDU.from_columns([c1, c2])
>       tbhdu.writeto(self.temp('tmp.fits'), clobber=True, checksum=True)

astropy/io/fits/tests/test_checksum.py:189: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
astropy/io/fits/hdu/base.py:1754: in writeto
    checksum=checksum)
astropy/io/fits/hdu/hdulist.py:680: in writeto
    hdu._prewriteto(checksum=checksum)
astropy/io/fits/hdu/table.py:527: in _prewriteto
    return super(_TableBaseHDU, self)._prewriteto(checksum, inplace)
astropy/io/fits/hdu/base.py:568: in _prewriteto
    self._update_checksum(checksum)
astropy/io/fits/hdu/base.py:625: in _update_checksum
    datasum_keyword=datasum_keyword)
astropy/io/fits/hdu/base.py:1403: in add_checksum
    datasum_keyword=datasum_keyword)
astropy/io/fits/hdu/base.py:1353: in add_datasum
    cs = self._calculate_datasum(blocking)
astropy/io/fits/hdu/table.py:834: in _calculate_datasum
    return self._calculate_datasum_with_heap(blocking)
astropy/io/fits/hdu/table.py:804: in _calculate_datasum_with_heap
    csum = self._compute_checksum(dout, blocking=blocking)
astropy/io/fits/hdu/base.py:1609: in _compute_checksum
    sum32 = self._compute_hdu_checksum(data[i:i + length], sum32)
astropy/io/fits/fitsrec.py:486: in __getitem__
    out = self.view(np.recarray).__getitem__(key).view(subtype)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("recarray has no attribute _nfields") raised in repr()] FITS_rec object at 0x2b5c64ac07b8>
obj = array([ 2,  0,  0,  0,  0,  0,  0,  0, 11,  0,  3,  0,  3,  0,  0,  0,  8,
        0,  0,  0, 12,  0,  4,  0], dtype=uint8)

    def __array_finalize__(self, obj):
        if obj is None:
            return

        if isinstance(obj, FITS_rec):
            self._converted = obj._converted
            self._heapoffset = obj._heapoffset
            self._heapsize = obj._heapsize
            self._coldefs = obj._coldefs
            self._nfields = obj._nfields
            self._gap = obj._gap
            self._uint = obj._uint
        else:
            # This will allow regular ndarrays with fields, rather than
            # just other FITS_rec objects
>           self._nfields = len(obj.dtype.names)
E           TypeError: object of type 'NoneType' has no len()

astropy/io/fits/fitsrec.py:249: TypeError
__________________________________________________ TestChecksumFunctions.test_compressed_image_data_int16 ___________________________________________________

self = <astropy.io.fits.tests.test_checksum.TestChecksumFunctions object at 0x2b5c64940908>

    def test_compressed_image_data_int16(self):
        n = np.arange(100, dtype='int16')
        hdu = fits.ImageHDU(n)
        comp_hdu = fits.CompImageHDU(hdu.data, hdu.header)
>       comp_hdu.writeto(self.temp('tmp.fits'), checksum=True)

astropy/io/fits/tests/test_checksum.py:246: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
astropy/io/fits/hdu/base.py:1754: in writeto
    checksum=checksum)
astropy/io/fits/hdu/hdulist.py:680: in writeto
    hdu._prewriteto(checksum=checksum)
astropy/io/fits/hdu/compressed.py:1844: in _prewriteto
    inplace=inplace)
astropy/io/fits/hdu/table.py:527: in _prewriteto
    return super(_TableBaseHDU, self)._prewriteto(checksum, inplace)
astropy/io/fits/hdu/base.py:568: in _prewriteto
    self._update_checksum(checksum)
astropy/io/fits/hdu/base.py:625: in _update_checksum
    datasum_keyword=datasum_keyword)
astropy/io/fits/hdu/base.py:1403: in add_checksum
    datasum_keyword=datasum_keyword)
astropy/io/fits/hdu/base.py:1353: in add_datasum
    cs = self._calculate_datasum(blocking)
astropy/io/fits/hdu/table.py:834: in _calculate_datasum
    return self._calculate_datasum_with_heap(blocking)
astropy/io/fits/hdu/table.py:804: in _calculate_datasum_with_heap
    csum = self._compute_checksum(dout, blocking=blocking)
astropy/io/fits/hdu/base.py:1609: in _compute_checksum
    sum32 = self._compute_hdu_checksum(data[i:i + length], sum32)
astropy/io/fits/fitsrec.py:486: in __getitem__
    out = self.view(np.recarray).__getitem__(key).view(subtype)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("recarray has no attribute _nfields") raised in repr()] FITS_rec object at 0x2b5c64a5e2e8>
obj = array([ 0,  0,  0, 42,  0,  0,  0,  0], dtype=uint8)

    def __array_finalize__(self, obj):
        if obj is None:
            return

        if isinstance(obj, FITS_rec):
            self._converted = obj._converted
            self._heapoffset = obj._heapoffset
            self._heapsize = obj._heapsize
            self._coldefs = obj._coldefs
            self._nfields = obj._nfields
            self._gap = obj._gap
            self._uint = obj._uint
        else:
            # This will allow regular ndarrays with fields, rather than
            # just other FITS_rec objects
>           self._nfields = len(obj.dtype.names)
E           TypeError: object of type 'NoneType' has no len()

astropy/io/fits/fitsrec.py:249: TypeError
_________________________________________________ TestChecksumFunctions.test_compressed_image_data_float32 __________________________________________________

self = <astropy.io.fits.tests.test_checksum.TestChecksumFunctions object at 0x2b5c64e736d8>

    def test_compressed_image_data_float32(self):
        n = np.arange(100, dtype='float32')
        hdu = fits.ImageHDU(n)
        comp_hdu = fits.CompImageHDU(hdu.data, hdu.header)
>       comp_hdu.writeto(self.temp('tmp.fits'), checksum=True)

astropy/io/fits/tests/test_checksum.py:278: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
astropy/io/fits/hdu/base.py:1754: in writeto
    checksum=checksum)
astropy/io/fits/hdu/hdulist.py:680: in writeto
    hdu._prewriteto(checksum=checksum)
astropy/io/fits/hdu/compressed.py:1844: in _prewriteto
    inplace=inplace)
astropy/io/fits/hdu/table.py:527: in _prewriteto
    return super(_TableBaseHDU, self)._prewriteto(checksum, inplace)
astropy/io/fits/hdu/base.py:568: in _prewriteto
    self._update_checksum(checksum)
astropy/io/fits/hdu/base.py:625: in _update_checksum
    datasum_keyword=datasum_keyword)
astropy/io/fits/hdu/base.py:1403: in add_checksum
    datasum_keyword=datasum_keyword)
astropy/io/fits/hdu/base.py:1353: in add_datasum
    cs = self._calculate_datasum(blocking)
astropy/io/fits/hdu/table.py:834: in _calculate_datasum
    return self._calculate_datasum_with_heap(blocking)
astropy/io/fits/hdu/table.py:804: in _calculate_datasum_with_heap
    csum = self._compute_checksum(dout, blocking=blocking)
astropy/io/fits/hdu/base.py:1609: in _compute_checksum
    sum32 = self._compute_hdu_checksum(data[i:i + length], sum32)
astropy/io/fits/fitsrec.py:486: in __getitem__
    out = self.view(np.recarray).__getitem__(key).view(subtype)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("recarray has no attribute _nfields") raised in repr()] FITS_rec object at 0x2b5c640f1f28>
obj = array([  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 214,   0,
         0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
         0,   0,   0,   0,   0,   0], dtype=uint8)

    def __array_finalize__(self, obj):
        if obj is None:
            return

        if isinstance(obj, FITS_rec):
            self._converted = obj._converted
            self._heapoffset = obj._heapoffset
            self._heapsize = obj._heapsize
            self._coldefs = obj._coldefs
            self._nfields = obj._nfields
            self._gap = obj._gap
            self._uint = obj._uint
        else:
            # This will allow regular ndarrays with fields, rather than
            # just other FITS_rec objects
>           self._nfields = len(obj.dtype.names)
E           TypeError: object of type 'NoneType' has no len()

astropy/io/fits/fitsrec.py:249: TypeError
________________________________________________ TestChecksumFunctions.test_open_update_mode_update_checksum ________________________________________________

self = <astropy.io.fits.tests.test_checksum.TestChecksumFunctions object at 0x2b5c648dff98>

    def test_open_update_mode_update_checksum(self):
        """
            Regression test for https://aeon.stsci.edu/ssb/trac/pyfits/ticket/148, part
            2.  This ensures that if a file contains a checksum, the checksum is
            updated when changes are saved to the file, even if the file was opened
            with the default of checksum=False.

            An existing checksum and/or datasum are only stripped if the file is
            opened with checksum='remove'.
            """

        self.copy_file('checksum.fits')
        with fits.open(self.temp('checksum.fits')) as hdul:
            header = hdul[1].header.copy()
            data = hdul[1].data.copy()

        with fits.open(self.temp('checksum.fits'), mode='update') as hdul:
            hdul[1].header['FOO'] = 'BAR'
>           hdul[1].data[0]['TIME'] = 42

astropy/io/fits/tests/test_checksum.py:417: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
astropy/io/fits/hdu/hdulist.py:257: in __exit__
    self.close()
astropy/io/fits/hdu/hdulist.py:710: in close
    self.flush(output_verify=output_verify, verbose=verbose)
astropy/utils/decorators.py:522: in flush
    **_get_function_args(wrapped))
astropy/io/fits/util.py:255: in wrapped
    func(*args, **kwargs)
astropy/io/fits/hdu/hdulist.py:604: in flush
    self._flush_update()
astropy/io/fits/hdu/hdulist.py:926: in _flush_update
    hdu._prewriteto(checksum=hdu._output_checksum, inplace=True)
astropy/io/fits/hdu/table.py:527: in _prewriteto
    return super(_TableBaseHDU, self)._prewriteto(checksum, inplace)
astropy/io/fits/hdu/base.py:568: in _prewriteto
    self._update_checksum(checksum)
astropy/io/fits/hdu/base.py:625: in _update_checksum
    datasum_keyword=datasum_keyword)
astropy/io/fits/hdu/base.py:1403: in add_checksum
    datasum_keyword=datasum_keyword)
astropy/io/fits/hdu/base.py:1353: in add_datasum
    cs = self._calculate_datasum(blocking)
astropy/io/fits/hdu/table.py:834: in _calculate_datasum
    return self._calculate_datasum_with_heap(blocking)
astropy/io/fits/hdu/table.py:804: in _calculate_datasum_with_heap
    csum = self._compute_checksum(dout, blocking=blocking)
astropy/io/fits/hdu/base.py:1609: in _compute_checksum
    sum32 = self._compute_hdu_checksum(data[i:i + length], sum32)
astropy/io/fits/fitsrec.py:486: in __getitem__
    out = self.view(np.recarray).__getitem__(key).view(subtype)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("recarray has no attribute _nfields") raised in repr()] FITS_rec object at 0x2b5c6499f6d8>
obj = array([ 64,  69,   0,   0,   0,   0,   0,   0,  65, 188, 193, 210,  63,
       167, 155,  86,  64, 134, 250, 252,  57,...,  82, 164,  64,
       135,   8, 134,  83,  57, 130, 192,  65, 230, 182, 100,  63, 197,
       252, 202], dtype=uint8)

    def __array_finalize__(self, obj):
        if obj is None:
            return

        if isinstance(obj, FITS_rec):
            self._converted = obj._converted
            self._heapoffset = obj._heapoffset
            self._heapsize = obj._heapsize
            self._coldefs = obj._coldefs
            self._nfields = obj._nfields
            self._gap = obj._gap
            self._uint = obj._uint
        else:
            # This will allow regular ndarrays with fields, rather than
            # just other FITS_rec objects
>           self._nfields = len(obj.dtype.names)
E           TypeError: object of type 'NoneType' has no len()

astropy/io/fits/fitsrec.py:249: TypeError
__________________________________________________________ TestSingleTable.test_read_from_fileobj ___________________________________________________________

self = <astropy.io.fits.tests.test_connect.TestSingleTable object at 0x2b5c64af6160>
tmpdir = local('/tmp/.private/justin/pytest-justin/pytest-2/test_read_from_fileobj0')

    def test_read_from_fileobj(self, tmpdir):
        filename = str(tmpdir.join('test_read_from_fileobj.fits'))
        hdu = BinTableHDU(self.data)
        hdu.writeto(filename)
        with open(filename, 'rb') as f:
            t = Table.read(f)
>       assert equal_data(t, self.data)
E       assert equal_data(<Table masked=False length=4>\n   a       b            c         \n int64   str128      float64      \n-------- ------ --...035316621e+185\n33554432      b                4.5\n       3      c                6.7\n       4      d                8.9, array([(1, 'a', 2.3), (2, 'b', 4.5), (3, 'c', 6.7), (4, 'd', 8.9)], \n      dtype=[('a', '<i8'), ('b', '<U1'), ('c', '<f8')]))
E        +  where array([(1, 'a', 2.3), (2, 'b', 4.5), (3, 'c', 6.7), (4, 'd', 8.9)], \n      dtype=[('a', '<i8'), ('b', '<U1'), ('c', '<f8')]) = <astropy.io.fits.tests.test_connect.TestSingleTable object at 0x2b5c64af6160>.data

astropy/io/fits/tests/test_connect.py:130: AssertionError
_________________________________________________________________ TestMultipleHDU.test_read _________________________________________________________________

self = <astropy.io.fits.tests.test_connect.TestMultipleHDU object at 0x2b5c64bf05c0>
tmpdir = local('/tmp/.private/justin/pytest-justin/pytest-2/test_read0')

    def test_read(self, tmpdir):
        filename = str(tmpdir.join('test_read.fits'))
        self.hdus.writeto(filename)
        with catch_warnings() as l:
            t = Table.read(filename)
        assert len(l) == 1
        assert str(l[0].message).startswith(
            'hdu= was not specified but multiple tables are present, reading in first available table (hdu=1)')
>       assert equal_data(t, self.data1)
E       assert equal_data(<Table masked=False length=4>\n   a       b            c         \n int64   str128      float64      \n-------- ------ --...035316621e+185\n33554432      b                4.5\n       3      c                6.7\n       4      d                8.9, array([(1, 'a', 2.3), (2, 'b', 4.5), (3, 'c', 6.7), (4, 'd', 8.9)], \n      dtype=[('a', '<i8'), ('b', '<U1'), ('c', '<f8')]))
E        +  where array([(1, 'a', 2.3), (2, 'b', 4.5), (3, 'c', 6.7), (4, 'd', 8.9)], \n      dtype=[('a', '<i8'), ('b', '<U1'), ('c', '<f8')]) = <astropy.io.fits.tests.test_connect.TestMultipleHDU object at 0x2b5c64bf05c0>.data1

astropy/io/fits/tests/test_connect.py:168: AssertionError
__________________________________________________________ TestMultipleHDU.test_read_with_hdu_1[1] __________________________________________________________

self = <astropy.io.fits.tests.test_connect.TestMultipleHDU object at 0x2b5c64dac400>
tmpdir = local('/tmp/.private/justin/pytest-justin/pytest-2/test_read_with_hdu_1_1_0'), hdu = 1

    @pytest.mark.parametrize('hdu', [1, 'first'])
    def test_read_with_hdu_1(self, tmpdir, hdu):
        filename = str(tmpdir.join('test_read_with_hdu_1.fits'))
        self.hdus.writeto(filename)
        with catch_warnings() as l:
            t = Table.read(filename, hdu=hdu)
        assert len(l) == 0
>       assert equal_data(t, self.data1)
E       assert equal_data(<Table masked=False length=4>\n   a       b            c         \n int64   str128      float64      \n-------- ------ --...035316621e+185\n33554432      b                4.5\n       3      c                6.7\n       4      d                8.9, array([(1, 'a', 2.3), (2, 'b', 4.5), (3, 'c', 6.7), (4, 'd', 8.9)], \n      dtype=[('a', '<i8'), ('b', '<U1'), ('c', '<f8')]))
E        +  where array([(1, 'a', 2.3), (2, 'b', 4.5), (3, 'c', 6.7), (4, 'd', 8.9)], \n      dtype=[('a', '<i8'), ('b', '<U1'), ('c', '<f8')]) = <astropy.io.fits.tests.test_connect.TestMultipleHDU object at 0x2b5c64dac400>.data1

astropy/io/fits/tests/test_connect.py:184: AssertionError
________________________________________________________ TestMultipleHDU.test_read_with_hdu_1[first] ________________________________________________________

self = <astropy.io.fits.tests.test_connect.TestMultipleHDU object at 0x2b5c649dc390>
tmpdir = local('/tmp/.private/justin/pytest-justin/pytest-2/test_read_with_hdu_1_first_0'), hdu = 'first'

    @pytest.mark.parametrize('hdu', [1, 'first'])
    def test_read_with_hdu_1(self, tmpdir, hdu):
        filename = str(tmpdir.join('test_read_with_hdu_1.fits'))
        self.hdus.writeto(filename)
        with catch_warnings() as l:
            t = Table.read(filename, hdu=hdu)
        assert len(l) == 0
>       assert equal_data(t, self.data1)
E       assert equal_data(<Table masked=False length=4>\n   a       b            c         \n int64   str128      float64      \n-------- ------ --...035316621e+185\n33554432      b                4.5\n       3      c                6.7\n       4      d                8.9, array([(1, 'a', 2.3), (2, 'b', 4.5), (3, 'c', 6.7), (4, 'd', 8.9)], \n      dtype=[('a', '<i8'), ('b', '<U1'), ('c', '<f8')]))
E        +  where array([(1, 'a', 2.3), (2, 'b', 4.5), (3, 'c', 6.7), (4, 'd', 8.9)], \n      dtype=[('a', '<i8'), ('b', '<U1'), ('c', '<f8')]) = <astropy.io.fits.tests.test_connect.TestMultipleHDU object at 0x2b5c649dc390>.data1

astropy/io/fits/tests/test_connect.py:184: AssertionError
=========================================================== 10 failed, 36 passed in 2.87 seconds ============================================================

Activity

  1. mhvk commented on Oct 19, 2015

    @mhvk
    Contributor

    @jlec - thanks for reporting this! It is actually a known issue (#3854), with, fortunately, a solution about ready to be merged (#4228). I'll close this therefore, but not without making a note in #4228 that really we should wrap this up... Please do keep raising issues if we find problems!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions