Skip to content

test_reshape only tests zero-dim arrays #307

Closed
@ev-br

Description

@ev-br

Applying

diff --git a/array_api_tests/test_manipulation_functions.py b/array_api_tests/test_manipulation_functions.py
index b8a919c..4091d62 100644
--- a/array_api_tests/test_manipulation_functions.py
+++ b/array_api_tests/test_manipulation_functions.py
@@ -360,13 +360,13 @@ def reshape_shapes(draw, shape):
 
 
 @pytest.mark.unvectorized
-@pytest.mark.skip("flaky")  # TODO: fix!
 @given(
     x=hh.arrays(dtype=hh.all_dtypes, shape=hh.shapes(max_side=MAX_SIDE)),
     data=st.data(),
 )
 def test_reshape(x, data):
     shape = data.draw(reshape_shapes(x.shape))
+    assume(shape != ())
 
     out = xp.reshape(x, shape)

produces

    @pytest.mark.unvectorized
>   @given(
        x=hh.arrays(dtype=hh.all_dtypes, shape=hh.shapes(max_side=MAX_SIDE)),
        data=st.data(),
    )
E   hypothesis.errors.FailedHealthCheck: It looks like your strategy is filtering out a lot of data. Health check found 50 filtered examples but only 0 good ones. This will make your tests much slower, and also will probably distort the data generation quite a lot. You should adapt your strategy to filter less. This can also be caused by a low max_leaves parameter in recursive() calls
E   See https://hypothesis.readthedocs.io/en/latest/healthchecks.html for more information about this. If you want to disable just this health check, add HealthCheck.filter_too_much to the suppress_health_check settings for this test.

array_api_tests/test_manipulation_functions.py:363: FailedHealthCheck
----------------------------------------------------------------------------------------------- Hypothesis ------------------------------------------------------------------------------------------------
You can add @seed(155687042254395097095124787400607549680) to this test or run pytest with --hypothesis-seed=155687042254395097095124787400607549680 to reproduce this failure.

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