Skip to content

Two test failues on macos arm64 (Apple Silicon) #17635

@isuruf

Description

@isuruf

Reproducing code example:

pytest --verbose --pyargs numpy 

Error message:

=================================== FAILURES ===================================
__ TestMaskedArrayInPlaceArithmetics.test_inplace_floor_division_scalar_type ___

self = <numpy.ma.tests.test_core.TestMaskedArrayInPlaceArithmetics object at 0x11a5fb9d0>

    def test_inplace_floor_division_scalar_type(self):
        # Test of inplace division
        for t in self.othertypes:
            with warnings.catch_warnings(record=True) as w:
                warnings.filterwarnings("always")
                (x, y, xm) = (_.astype(t) for _ in self.uint8data)
                x = arange(10, dtype=t) * t(2)
                xm = arange(10, dtype=t) * t(2)
                xm[2] = masked
                x //= t(2)
                xm //= t(2)
                assert_equal(x, y)
                assert_equal(xm, y)
    
>               assert_equal(len(w), 0, "Failed on type=%s." % t)

../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib/python3.9/site-packages/numpy/ma/tests/test_core.py:2833: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

actual = 4, desired = 0, err_msg = "Failed on type=<class 'numpy.complex64'>."

    def assert_equal(actual, desired, err_msg=''):
        """
        Asserts that two items are equal.
    
        """
        # Case #1: dictionary .....
        if isinstance(desired, dict):
            if not isinstance(actual, dict):
                raise AssertionError(repr(type(actual)))
            assert_equal(len(actual), len(desired), err_msg)
            for k, i in desired.items():
                if k not in actual:
                    raise AssertionError("%s not in %s" % (k, actual))
                assert_equal(actual[k], desired[k], 'key=%r\n%s' % (k, err_msg))
            return
        # Case #2: lists .....
        if isinstance(desired, (list, tuple)) and isinstance(actual, (list, tuple)):
            return _assert_equal_on_sequences(actual, desired, err_msg='')
        if not (isinstance(actual, ndarray) or isinstance(desired, ndarray)):
            msg = build_err_msg([actual, desired], err_msg,)
            if not desired == actual:
>               raise AssertionError(msg)
E               AssertionError: 
E               Items are not equal: Failed on type=<class 'numpy.complex64'>.
E                ACTUAL: 4
E                DESIRED: 0

../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib/python3.9/site-packages/numpy/ma/testutils.py:129: AssertionError
___ TestMaskedArrayInPlaceArithmetics.test_inplace_floor_division_array_type ___

self = <numpy.ma.tests.test_core.TestMaskedArrayInPlaceArithmetics object at 0x11abc3df0>

    def test_inplace_floor_division_array_type(self):
        # Test of inplace division
        for t in self.othertypes:
            with warnings.catch_warnings(record=True) as w:
                warnings.filterwarnings("always")
                (x, y, xm) = (_.astype(t) for _ in self.uint8data)
                m = xm.mask
                a = arange(10, dtype=t)
                a[-1] = masked
                x //= a
                xm //= a
                assert_equal(x, y // a)
                assert_equal(xm, y // a)
                assert_equal(
                    xm.mask,
                    mask_or(mask_or(m, a.mask), (a == t(0)))
                )
    
>               assert_equal(len(w), 0, "Failed on type=%s." % t)

../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib/python3.9/site-packages/numpy/ma/tests/test_core.py:2853: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

actual = 4, desired = 0, err_msg = "Failed on type=<class 'numpy.complex64'>."

    def assert_equal(actual, desired, err_msg=''):
        """
        Asserts that two items are equal.
    
        """
        # Case #1: dictionary .....
        if isinstance(desired, dict):
            if not isinstance(actual, dict):
                raise AssertionError(repr(type(actual)))
            assert_equal(len(actual), len(desired), err_msg)
            for k, i in desired.items():
                if k not in actual:
                    raise AssertionError("%s not in %s" % (k, actual))
                assert_equal(actual[k], desired[k], 'key=%r\n%s' % (k, err_msg))
            return
        # Case #2: lists .....
        if isinstance(desired, (list, tuple)) and isinstance(actual, (list, tuple)):
            return _assert_equal_on_sequences(actual, desired, err_msg='')
        if not (isinstance(actual, ndarray) or isinstance(desired, ndarray)):
            msg = build_err_msg([actual, desired], err_msg,)
            if not desired == actual:
>               raise AssertionError(msg)
E               AssertionError: 
E               Items are not equal: Failed on type=<class 'numpy.complex64'>.
E                ACTUAL: 4
E                DESIRED: 0

../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib/python3.9/site-packages/numpy/ma/testutils.py:129: AssertionError

NumPy/Python version information:

Failures with numpy 1.19.2 and python 3.9.0 and 3.8.6

We've been cross compiling packages for this new hardware at conda-forge and running tests on the Developer Transition Kit. cc @erykoff, @beckermr, @rgommers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions