Skip to content

Issue upgrading pydata/sparse to v2025.12 #436

@prady0t

Description

@prady0t

Upgrading to v2025.12 in pydata/sparse, gives a weird error for test_floor_divide[__ifloordiv__(x1, x2)] test. See the issue: pydata/sparse#943

_____________________________________ test_floor_divide[__ifloordiv__(x1, x2)] ______________________________________
[gw3] darwin -- Python 3.13.14 /Users/pradyotranjan/sparse-1/.pixi/envs/xp-tests/bin/python3.13
  + Exception Group Traceback (most recent call last):
  |   File "/Users/pradyotranjan/sparse-1/array-api-tests/array_api_tests/test_operators_and_elementwise_functions.py", line 1376, in test_floor_divide
  |     @given(data=st.data())
  |                    ~~~~^^
  |   File "/Users/pradyotranjan/sparse-1/.pixi/envs/xp-tests/lib/python3.13/site-packages/hypothesis/core.py", line 2274, in wrapped_test
  |     raise the_error_hypothesis_found
  | ExceptionGroup: Hypothesis found 2 distinct failures. (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/Users/pradyotranjan/sparse-1/array-api-tests/array_api_tests/test_operators_and_elementwise_functions.py", line 1393, in test_floor_divide
    |     binary_param_assert_against_refimpl(ctx, left, right, res, "//", operator.floordiv)
    |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/pradyotranjan/sparse-1/array-api-tests/array_api_tests/test_operators_and_elementwise_functions.py", line 680, in binary_param_assert_against_refimpl
    |     binary_assert_against_refimpl(
    |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    |         func_name=ctx.func_name,
    |         ^^^^^^^^^^^^^^^^^^^^^^^^
    |     ...<10 lines>...
    |         strict_check=strict_check,
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |     )
    |     ^
    |   File "/Users/pradyotranjan/sparse-1/array-api-tests/array_api_tests/test_operators_and_elementwise_functions.py", line 349, in binary_assert_against_refimpl
    |     assert isclose(scalar_o, expected, M), msg
    | AssertionError: x1=3.0, but should be roughly (x1 // x2)=1.0 [__ifloordiv__()]
    |   x1=3.0, x2=2.0
    | assert False
    |  +  where False = isclose(3.0, 1.0, 1.7976931348623157e+308)
    | 
    | ========== FAILING CODE SNIPPET:
    | __ifloordiv__(<COO: shape=(), dtype=float64, nnz=1, fill_value=0.0>, <COO: shape=(), dtype=float32, nnz=1, fill_value=0.0>)
    | ====================
    | 
    | Falsifying example: test_floor_divide(
    |     # The test always failed when commented parts were varied together.
    |     ctx=BinaryParamContext(<__ifloordiv__(x1, x2)>),
    |     data=data(...),
    | )
    | Draw 1 (x1): _f(<...>, False)
    | Draw 2 (x2): _f(
    |     <...>,
    |     False,  # or any other generated value
    | )
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File "/Users/pradyotranjan/sparse-1/array-api-tests/array_api_tests/test_operators_and_elementwise_functions.py", line 1393, in test_floor_divide
    |     binary_param_assert_against_refimpl(ctx, left, right, res, "//", operator.floordiv)
    |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/pradyotranjan/sparse-1/array-api-tests/array_api_tests/test_operators_and_elementwise_functions.py", line 680, in binary_param_assert_against_refimpl
    |     binary_assert_against_refimpl(
    |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    |         func_name=ctx.func_name,
    |         ^^^^^^^^^^^^^^^^^^^^^^^^
    |     ...<10 lines>...
    |         strict_check=strict_check,
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |     )
    |     ^
    |   File "/Users/pradyotranjan/sparse-1/array-api-tests/array_api_tests/test_operators_and_elementwise_functions.py", line 351, in binary_assert_against_refimpl
    |     assert scalar_o == expected, (
    |     ...<2 lines>...
    |     )
    | AssertionError: x1=-1, but should be (x1 // x2)=1 [__ifloordiv__()]
    |   x1=-1, x2=-1
    | assert -1 == 1
    | 
    | ========== FAILING CODE SNIPPET:
    | __ifloordiv__(<COO: shape=(), dtype=int8, nnz=1, fill_value=0>, <COO: shape=(), dtype=int8, nnz=1, fill_value=0>)
    | ====================
    | 
    | Falsifying example: test_floor_divide(
    |     # The test always failed when commented parts were varied together.
    |     ctx=BinaryParamContext(<__ifloordiv__(x1, x2)>),
    |     data=data(...),
    | )
    | Draw 1 (x1): _f(
    |     <...>,  # or any other generated value
    |     False,
    | )
    | Draw 2 (x2): _f(
    |     <...>,
    |     False,  # or any other generated value
    | )
    | Explanation:
    |     These lines were always and only run by failing examples:
    |         /Users/pradyotranjan/sparse-1/array-api-tests/array_api_tests/test_operators_and_elementwise_functions.py:352
    |         /Users/pradyotranjan/sparse-1/array-api-tests/array_api_tests/test_operators_and_elementwise_functions.py:354

array_api_tests/test_operators_and_elementwise_functions.py::test_floor_divide[__ifloordiv__(x1, x2)] - ExceptionGroup: Hypothesis found 2 distinct failures. (2 sub-exceptions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions