Skip to content

Commit bedb22f

Browse files
authored
Merge pull request #488 from Blosc/elementwise-tests-heavy
Separate heavy tests in element wise testing
2 parents 86f49b9 + 155d370 commit bedb22f

File tree

1 file changed

+36
-9
lines changed

1 file changed

+36
-9
lines changed

tests/ndarray/test_elementwise_funcs.py

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@
3232
UNARY_FUNC_PAIRS.append((np.count_nonzero, blosc2.count_nonzero))
3333

3434
DTYPES = [blosc2.bool_, blosc2.int32, blosc2.int64, blosc2.float32, blosc2.float64, blosc2.complex128]
35-
SHAPES_CHUNKS = [((10,), (3,)), ((20, 20), (4, 7)), ((10, 13, 13), (3, 5, 2))]
35+
SHAPES_CHUNKS = [((10,), (3,)), ((20, 20), (4, 7))]
36+
SHAPES_CHUNKS_HEAVY = [((10, 13, 13), (3, 5, 2))]
3637

3738

38-
@pytest.mark.parametrize(("np_func", "blosc_func"), UNARY_FUNC_PAIRS)
39-
@pytest.mark.parametrize("dtype", DTYPES)
40-
@pytest.mark.parametrize(("shape", "chunkshape"), SHAPES_CHUNKS)
41-
def test_unary_funcs(np_func, blosc_func, dtype, shape, chunkshape): # noqa : C901
39+
def _test_unary_func_impl(np_func, blosc_func, dtype, shape, chunkshape): # noqa: C901
40+
"""Helper function containing the actual test logic for unary functions."""
4241
if np_func.__name__ in ("arccos", "arcsin", "arctanh"):
4342
a_blosc = blosc2.linspace(
4443
0.01, stop=0.99, num=np.prod(shape), chunks=chunkshape, shape=shape, dtype=dtype
@@ -109,10 +108,8 @@ def test_unary_funcs(np_func, blosc_func, dtype, shape, chunkshape): # noqa : C
109108
raise e
110109

111110

112-
@pytest.mark.parametrize(("np_func", "blosc_func"), BINARY_FUNC_PAIRS)
113-
@pytest.mark.parametrize("dtype", DTYPES)
114-
@pytest.mark.parametrize(("shape", "chunkshape"), SHAPES_CHUNKS)
115-
def test_binary_funcs(np_func, blosc_func, dtype, shape, chunkshape): # noqa : C901
111+
def _test_binary_func_impl(np_func, blosc_func, dtype, shape, chunkshape): # noqa: C901
112+
"""Helper function containing the actual test logic for binary functions."""
116113
a_blosc1 = blosc2.linspace(
117114
1, stop=np.prod(shape), num=np.prod(shape), chunks=chunkshape, shape=shape, dtype=dtype
118115
)
@@ -185,3 +182,33 @@ def test_binary_funcs(np_func, blosc_func, dtype, shape, chunkshape): # noqa :
185182
pytest.skip("minimum and maximum for numexpr do not match NaN behaviour for numpy")
186183
else:
187184
raise e
185+
186+
187+
@pytest.mark.parametrize(("np_func", "blosc_func"), UNARY_FUNC_PAIRS)
188+
@pytest.mark.parametrize("dtype", DTYPES)
189+
@pytest.mark.parametrize(("shape", "chunkshape"), SHAPES_CHUNKS)
190+
def test_unary_funcs(np_func, blosc_func, dtype, shape, chunkshape):
191+
_test_unary_func_impl(np_func, blosc_func, dtype, shape, chunkshape)
192+
193+
194+
@pytest.mark.heavy
195+
@pytest.mark.parametrize(("np_func", "blosc_func"), UNARY_FUNC_PAIRS)
196+
@pytest.mark.parametrize("dtype", DTYPES)
197+
@pytest.mark.parametrize(("shape", "chunkshape"), SHAPES_CHUNKS_HEAVY)
198+
def test_unary_funcs_heavy(np_func, blosc_func, dtype, shape, chunkshape):
199+
_test_unary_func_impl(np_func, blosc_func, dtype, shape, chunkshape)
200+
201+
202+
@pytest.mark.parametrize(("np_func", "blosc_func"), BINARY_FUNC_PAIRS)
203+
@pytest.mark.parametrize("dtype", DTYPES)
204+
@pytest.mark.parametrize(("shape", "chunkshape"), SHAPES_CHUNKS)
205+
def test_binary_funcs(np_func, blosc_func, dtype, shape, chunkshape):
206+
_test_binary_func_impl(np_func, blosc_func, dtype, shape, chunkshape)
207+
208+
209+
@pytest.mark.heavy
210+
@pytest.mark.parametrize(("np_func", "blosc_func"), BINARY_FUNC_PAIRS)
211+
@pytest.mark.parametrize("dtype", DTYPES)
212+
@pytest.mark.parametrize(("shape", "chunkshape"), SHAPES_CHUNKS_HEAVY)
213+
def test_binary_funcs_heavy(np_func, blosc_func, dtype, shape, chunkshape):
214+
_test_binary_func_impl(np_func, blosc_func, dtype, shape, chunkshape)

0 commit comments

Comments
 (0)