|
32 | 32 | UNARY_FUNC_PAIRS.append((np.count_nonzero, blosc2.count_nonzero)) |
33 | 33 |
|
34 | 34 | 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))] |
36 | 37 |
|
37 | 38 |
|
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.""" |
42 | 41 | if np_func.__name__ in ("arccos", "arcsin", "arctanh"): |
43 | 42 | a_blosc = blosc2.linspace( |
44 | 43 | 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 |
109 | 108 | raise e |
110 | 109 |
|
111 | 110 |
|
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.""" |
116 | 113 | a_blosc1 = blosc2.linspace( |
117 | 114 | 1, stop=np.prod(shape), num=np.prod(shape), chunks=chunkshape, shape=shape, dtype=dtype |
118 | 115 | ) |
@@ -185,3 +182,33 @@ def test_binary_funcs(np_func, blosc_func, dtype, shape, chunkshape): # noqa : |
185 | 182 | pytest.skip("minimum and maximum for numexpr do not match NaN behaviour for numpy") |
186 | 183 | else: |
187 | 184 | 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