Skip to content

Binary operator tests fail on i386 with python 3.10

Hi, tinyarray seems to have issues with python3.10 on i386. I wonder if the problem may somehow be related to https://github.com/python/cpython/issues/82180.

This issue is tracked in Debian as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1017051.

=================================== FAILURES ===================================
____________________________ test_binary_operators _____________________________

    def test_binary_operators():
        ops = operator
        operations = [ops.add, ops.sub, ops.mul, ops.mod,
ops.floordiv, ops.truediv]
        if sys.version_info.major < 3:
            operations.append(ops.div)

        with warnings.catch_warnings():
            warnings.filterwarnings("ignore", category=RuntimeWarning)

            for op in operations:
                for dtype in dtypes:
                    for shape in [(), 1, 3, (3, 2)]:
                        if dtype is complex and op in [ops.mod, ops.floordiv]:
                            continue
                        a = make(shape, dtype)
                        b = make(shape, dtype)
>                       assert_equal(op(ta.array(a.tolist()), ta.array(b.tolist())),
                                     op(a, b))
E                       AssertionError:
E                       Arrays are not equal
E
E                       Mismatched elements: 2 / 3 (66.7%)
E                       Max absolute difference: 1.11022302e-16
E                       Max relative difference: 1.11022302e-16
E                        x: array([nan+nanj,  1. +0.j,  1. +0.j])
E                        y: array([nan+nanj,  1. +0.j,  1. +0.j])

../../../test_tinyarray.py:375: AssertionError
______________________________ test_binary_ufuncs ______________________________

    def test_binary_ufuncs():
        with warnings.catch_warnings():
            warnings.filterwarnings("ignore", category=RuntimeWarning)

            for name in ["add", "subtract", "multiply", "divide",
                         "remainder", "floor_divide"]:
                np_func = np.__dict__[name]
                ta_func = ta.__dict__[name]
                for dtype in dtypes:
                    for shape in [(), 1, 3, (3, 2)]:
                        if dtype is complex and \
                                name in ["remainder", "floor_divide"]:
                            continue
                        a = make(shape, dtype)
                        b = make(shape, dtype)
>                       assert_equal(ta_func(a.tolist(), b.tolist()),
                                     np_func(a, b))
E                       AssertionError:
E                       Arrays are not equal
E
E                       Mismatched elements: 2 / 3 (66.7%)
E                       Max absolute difference: 1.11022302e-16
E                       Max relative difference: 1.11022302e-16
E                        x: array([nan+nanj,  1. +0.j,  1. +0.j])
E                        y: array([nan+nanj,  1. +0.j,  1. +0.j])

../../../test_tinyarray.py:396: AssertionError