[AstroPy] errors returned by astropy.test()

Erik Bray embray at stsci.edu
Sun Jul 5 12:01:31 EDT 2015


Hi,

You seem to have a pre-release version of Numpy for some reason--specifically 
Numpy 1.8.0rc1.  So some code that works around issues with Numpy versions less 
than 1.8.0 is behaving awkwardly, since 1.8.0rc1 is technically less than 1.8.0 
(granted, those checks should probably ignore pre-release specifiers).

In other words, upgrade your Numpy to a released version and it should be fine.

Erik

On 07/05/2015 11:42 AM, José Vinícius wrote:
> Hi guys!
>
> I'm trying to install the developer's version of astropy, and after using
>  >> import astropy
>  >> astropy.test()
> I'm receiving several errors: *= 9 failed, 9053 passed, 170 skipped, 43 xfailed,
> 2 xpassed in 284.03 seconds == *1
>
> The log of failures is as follows
>
> =================================== FAILURES ===================================
>
> _______________________ test_getitem_metadata_regression _______________________
>
>
> *    def test_getitem_metadata_regression():*
>
> *        """*
>
> *        Regression test for #1471: MaskedArray does not call __array_finalize__ so*
>
> *        the meta-data was not getting copied over. By overloading _update_from we*
>
> *        are able to work around this bug.*
>
> *        """*
>
> **
>
> *        # Make sure that meta-data gets propagated with __getitem__*
>
> **
>
> *        c = table.Column(data=[1,2], name='a', description='b', unit='m',
> format="%i", meta={'c': 8})*
>
> *        assert c[1:2].name == 'a'*
>
> *        assert c[1:2].description == 'b'*
>
> *        assert c[1:2].unit == 'm'*
>
> *        assert c[1:2].format == '%i'*
>
> *        assert c[1:2].meta['c'] == 8*
>
> **
>
> *        c = table.MaskedColumn(data=[1,2], name='a', description='b', unit='m',
> format="%i", meta={'c': 8})*
>
> *        assert c[1:2].name == 'a'*
>
> *        assert c[1:2].description == 'b'*
>
> *        assert c[1:2].unit == 'm'*
>
> *        assert c[1:2].format == '%i'*
>
> *        assert c[1:2].meta['c'] == 8*
>
> **
>
> *        # As above, but with take() - check the method and the function*
>
> **
>
> *        c = table.Column(data=[1,2,3], name='a', description='b', unit='m',
> format="%i", meta={'c': 8})*
>
> *        for subset in [c.take([0, 1]), np.take(c, [0, 1])]:*
>
> *            assert subset.name <http://subset.name> == 'a'*
>
> *            assert subset.description == 'b'*
>
> *            assert subset.unit == 'm'*
>
> *            assert subset.format == '%i'*
>
> *            assert subset.meta['c'] == 8*
>
> **
>
> *        # Metadata isn't copied for scalar values*
>
> *        if NUMPY_LT_1_8:*
>
> *            with pytest.raises(ValueError):*
>
> *>               c.take(0)*
>
> *E               Failed: DID NOT RAISE*
>
>
> astropy/table/tests/test_column.py:467: Failed
>
> _______________________ test_getitem_metadata_regression _______________________
>
>
> *    def test_getitem_metadata_regression():*
>
> *        """*
>
> *        Regression test for #1471: MaskedArray does not call __array_finalize__ so*
>
> *        the meta-data was not getting copied over. By overloading _update_from we*
>
> *        are able to work around this bug.*
>
> *        """*
>
> **
>
> *        # Make sure that meta-data gets propagated with __getitem__*
>
> **
>
> *        c = table.Column(data=[1,2], name='a', description='b', unit='m',
> format="%i", meta={'c': 8})*
>
> *        assert c[1:2].name == 'a'*
>
> *        assert c[1:2].description == 'b'*
>
> *        assert c[1:2].unit == 'm'*
>
> *        assert c[1:2].format == '%i'*
>
> *        assert c[1:2].meta['c'] == 8*
>
> **
>
> *        c = table.MaskedColumn(data=[1,2], name='a', description='b', unit='m',
> format="%i", meta={'c': 8})*
>
> *        assert c[1:2].name == 'a'*
>
> *        assert c[1:2].description == 'b'*
>
> *        assert c[1:2].unit == 'm'*
>
> *        assert c[1:2].format == '%i'*
>
> *        assert c[1:2].meta['c'] == 8*
>
> **
>
> *        # As above, but with take() - check the method and the function*
>
> **
>
> *        c = table.Column(data=[1,2,3], name='a', description='b', unit='m',
> format="%i", meta={'c': 8})*
>
> *        for subset in [c.take([0, 1]), np.take(c, [0, 1])]:*
>
> *            assert subset.name <http://subset.name> == 'a'*
>
> *            assert subset.description == 'b'*
>
> *            assert subset.unit == 'm'*
>
> *            assert subset.format == '%i'*
>
> *            assert subset.meta['c'] == 8*
>
> **
>
> *        # Metadata isn't copied for scalar values*
>
> *        if NUMPY_LT_1_8:*
>
> *            with pytest.raises(ValueError):*
>
> *>               c.take(0)*
>
> *E               Failed: DID NOT RAISE*
>
>
> astropy/table/tests/test_column.py:467: Failed
>
> _______________________ test_masked_row_with_object_col ________________________
>
>
> *    def test_masked_row_with_object_col():*
>
> *        """*
>
> *        Numpy < 1.8 has a bug in masked array that prevents access a row if
> there is*
>
> *        a column with object type.*
>
> *        """*
>
> *        t = table.Table([[1]], dtype=['O'], masked=True)*
>
> *        if NUMPY_LT_1_8:*
>
> *            with pytest.raises(ValueError):*
>
> *                t['col0'].mask = False*
>
> *>               t[0].as_void()*
>
> *E               Failed: DID NOT RAISE*
>
>
> astropy/table/tests/test_row.py:26: Failed
>
> ______________ TestRow.test_row_and_as_void_with_objects[masked] _______________
>
>
> self = <astropy.table.tests.test_row.TestRow instance at 0x108ed2ab8>
>
> table_types = <astropy.table.tests.conftest.TableTypes instance at 0x108ed2368>
>
>
> *    def test_row_and_as_void_with_objects(self, table_types):*
>
> *        """Test the deprecated data property and as_void() method"""*
>
> *        t = table_types.Table([[{'a': 1}, {'b': 2}]], names=('a',))*
>
> *        assert t[0][0] == {'a': 1}*
>
> *        assert t[0]['a'] == {'a': 1}*
>
> *        if NUMPY_LT_1_8 and t.masked:*
>
> *            # With numpy < 1.8 there is a bug setting mvoid with*
>
> *            # an object.*
>
> *            with pytest.raises(ValueError):*
>
> *>               t[0].as_void()*
>
> *E               Failed: DID NOT RAISE*
>
>
> astropy/table/tests/test_row.py:197: Failed
>
> _______________________ test_masked_row_with_object_col ________________________
>
>
> *    def test_masked_row_with_object_col():*
>
> *        """*
>
> *        Numpy < 1.8 has a bug in masked array that prevents access a row if
> there is*
>
> *        a column with object type.*
>
> *        """*
>
> *        t = table.Table([[1]], dtype=['O'], masked=True)*
>
> *        if NUMPY_LT_1_8:*
>
> *            with pytest.raises(ValueError):*
>
> *                t['col0'].mask = False*
>
> *>               t[0].as_void()*
>
> *E               Failed: DID NOT RAISE*
>
>
> astropy/table/tests/test_row.py:26: Failed
>
> ______________ TestRow.test_row_and_as_void_with_objects[masked] _______________
>
>
> self = <astropy.table.tests.test_row.TestRow instance at 0x10928e128>
>
> table_types = <astropy.table.tests.conftest.TableTypes instance at 0x105bae128>
>
>
> *    def test_row_and_as_void_with_objects(self, table_types):*
>
> *        """Test the deprecated data property and as_void() method"""*
>
> *        t = table_types.Table([[{'a': 1}, {'b': 2}]], names=('a',))*
>
> *        assert t[0][0] == {'a': 1}*
>
> *        assert t[0]['a'] == {'a': 1}*
>
> *        if NUMPY_LT_1_8 and t.masked:*
>
> *            # With numpy < 1.8 there is a bug setting mvoid with*
>
> *            # an object.*
>
> *            with pytest.raises(ValueError):*
>
> *>               t[0].as_void()*
>
> *E               Failed: DID NOT RAISE*
>
>
> astropy/table/tests/test_row.py:197: Failed
>
> _________________________ test_repr_array_of_quantity __________________________
>
>
> *    def test_repr_array_of_quantity():*
>
> *        """*
>
> *        Test print/repr of object arrays of Quantity objects with different*
>
> *        units.*
>
> **
>
> *        Regression test for the issue first reported in*
>
> *https://github.com/astropy/astropy/issues/3777*
>
> *        """*
>
> **
>
> *        a = np.array([1 * u.m, 2 * u.s], dtype=object)*
>
> *        if NUMPY_LT_1_7:*
>
> *            # Numpy 1.6.x has some different defaults for how to display object*
>
> *            # arrays (it uses the str() of the objects instead of the repr()*
>
> *            assert repr(a) == 'array([1.0 m, 2.0 s], dtype=object)'*
>
> *            assert str(a) == '[1.0 m 2.0 s]'*
>
> *        else:*
>
> *>           assert repr(a) == 'array([<Quantity 1.0 m>, <Quantity 2.0 s>],
> dtype=object)'*
>
> *E           assert 'array([1.0, ...dtype=object)' ==
> 'array([<Quant...dtype=object)'*
>
> *E             - array([1.0, 2.0], dtype=object)*
>
> *E             + array([<Quantity 1.0 m>, <Quantity 2.0 s>], dtype=object)*
>
>
> astropy/units/tests/test_quantity.py:1180: AssertionError
>
> ______________________ TestQuantityStatsFuncs.test_median ______________________
>
>
> self = <astropy.units.tests.test_quantity_array_methods.TestQuantityStatsFuncs
> object at 0x109b710d0>
>
>
> *    def test_median(self):*
>
> *        q1 = np.array([1., 2., 4., 5., 6.]) * u.m*
>
> *>       assert np.median(q1) == 4. * u.m*
>
> *E       assert 4.0 == (4.0 * Unit("m"))*
>
> *E        +  where 4.0 = <function median at 0x1027548c0>(<Quantity [ 1., 2.,
> 4., 5., 6.] m>)*
>
> *E        +    where <function median at 0x1027548c0> = np.median*
>
> *E        +  and   Unit("m") = u.m*
>
>
> astropy/units/tests/test_quantity_array_methods.py:178: AssertionError
>
> __________________ TestQuantityStatsFuncs.test_median_inplace __________________
>
>
> self = <astropy.units.tests.test_quantity_array_methods.TestQuantityStatsFuncs
> object at 0x109b7c2d0>
>
>
> *    def test_median_inplace(self):*
>
> *        q1 = np.array([1., 2., 4., 5., 6.]) * u.m*
>
> *        qi = 1.5 * u.s*
>
> *        np.median(q1, out=qi)*
>
> *>       assert qi == 4 * u.m*
>
> *E       assert <Quantity 4.0 s> == (4 * Unit("m"))*
>
> *E        +  where Unit("m") = u.m*
>
>
> astropy/units/tests/test_quantity_array_methods.py:184: AssertionError
>
> *= 9 failed, 9053 passed, 170 skipped, 43 xfailed, 2 xpassed in 284.03 seconds ==*
>
> 1
>
>
> Does anybody know what might be causing these errors? Is there anything to be
> concerned with?
>
> Thank you in advance.
>
> Astropy 1.1.dev12835
> Darwin-14.3.0 - 64bit
> Python 2.7.6
> Numpy 1.8.0rc1
> Scipy 0.13.0b1
> Matplotlib 1.3.1
> h5py 2.5.0
> CVLattes: http://lattes.cnpq.br/3267230342393209
>
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>




More information about the AstroPy mailing list