@@ -22,43 +22,44 @@ def dtype_fixture(request):
22
22
params = [
23
23
((10 ,), (5 ,), None ),
24
24
((31 ,), (14 ,), (9 ,)),
25
+ ((9 ,), (4 ,), (3 ,)),
25
26
]
26
27
)
27
- def shape_1d_chunks_blocks (request ):
28
+ def shape_chunks_blocks_1d (request ):
28
29
return request .param
29
30
30
31
31
32
@pytest .fixture (
32
33
params = [
33
- ((3 , 3 ), (2 , 2 ), (1 , 1 )),
34
+ ((4 , 4 ), (3 , 3 ), (2 , 2 )),
34
35
((12 , 11 ), (7 , 5 ), (6 , 2 )),
35
- ((1 , 5 ), (1 , 4 ), (1 , 3 )),
36
+ ((6 , 5 ), (5 , 4 ), (4 , 3 )),
36
37
pytest .param (((51 , 603 ), (22 , 99 ), (13 , 29 )), marks = pytest .mark .heavy ),
37
38
]
38
39
)
39
- def shape_2d_chunks_blocks (request ):
40
+ def shape_chunks_blocks_2d (request ):
40
41
return request .param
41
42
42
43
43
44
@pytest .fixture (
44
45
params = [
45
46
((4 , 5 , 2 ), (3 , 4 , 2 ), (3 , 2 , 1 )),
46
47
((12 , 10 , 10 ), (11 , 9 , 7 ), (9 , 7 , 3 )),
47
- pytest .param (((37 , 63 , 55 ), (12 , 5 , 41 ), (10 , 5 , 11 )), marks = pytest .mark .heavy ),
48
+ pytest .param (((37 , 63 , 55 ), (12 , 30 , 41 ), (10 , 5 , 11 )), marks = pytest .mark .heavy ),
48
49
]
49
50
)
50
- def shape_3d_chunks_blocks (request ):
51
+ def shape_chunks_blocks_3d (request ):
51
52
return request .param
52
53
53
54
54
55
@pytest .fixture (
55
56
params = [
56
- ((3 , 3 , 5 , 7 ), (2 , 3 , 2 , 4 ), (1 , 1 , 1 , 4 )),
57
+ ((3 , 3 , 5 , 7 ), (2 , 3 , 2 , 4 ), (1 , 2 , 1 , 4 )),
57
58
((4 , 6 , 5 , 2 ), (3 , 3 , 4 , 2 ), (3 , 2 , 2 , 1 )),
58
59
pytest .param (((10 , 10 , 10 , 11 ), (7 , 8 , 9 , 11 ), (6 , 7 , 8 , 5 )), marks = pytest .mark .heavy ),
59
60
]
60
61
)
61
- def shape_4d_chunks_blocks (request ):
62
+ def shape_chunks_blocks_4d (request ):
62
63
return request .param
63
64
64
65
@@ -79,14 +80,13 @@ def shape_4d_chunks_blocks(request):
79
80
},
80
81
)
81
82
def test_scalars (scalar ):
82
- at = blosc2 .permute_dims (scalar )
83
- nat = np .transpose (scalar )
84
-
85
- np .testing .assert_allclose (at , nat )
83
+ scalar_t = blosc2 .permute_dims (scalar )
84
+ np_scalar_t = np .transpose (scalar )
85
+ np .testing .assert_allclose (scalar_t , np_scalar_t )
86
86
87
87
88
- def test_1d_transpose ( shape_1d_chunks_blocks , dtype_fixture ):
89
- shape , chunks , blocks = shape_1d_chunks_blocks
88
+ def test_1d_permute_dims ( shape_chunks_blocks_1d , dtype_fixture ):
89
+ shape , chunks , blocks = shape_chunks_blocks_1d
90
90
a = blosc2 .linspace (0 , 1 , shape = shape , chunks = chunks , blocks = blocks , dtype = dtype_fixture )
91
91
at = blosc2 .permute_dims (a )
92
92
@@ -100,8 +100,8 @@ def test_1d_transpose(shape_1d_chunks_blocks, dtype_fixture):
100
100
"axes" ,
101
101
list (permutations ([0 , 1 ])),
102
102
)
103
- def test_2d_transpose ( shape_2d_chunks_blocks , dtype_fixture , axes ):
104
- shape , chunks , blocks = shape_2d_chunks_blocks
103
+ def test_2d_permute_dims ( shape_chunks_blocks_2d , dtype_fixture , axes ):
104
+ shape , chunks , blocks = shape_chunks_blocks_2d
105
105
a = blosc2 .linspace (0 , 1 , shape = shape , chunks = chunks , blocks = blocks , dtype = dtype_fixture )
106
106
at = blosc2 .permute_dims (a , axes = axes )
107
107
@@ -115,8 +115,8 @@ def test_2d_transpose(shape_2d_chunks_blocks, dtype_fixture, axes):
115
115
"axes" ,
116
116
list (permutations ([0 , 1 , 2 ])),
117
117
)
118
- def test_3d_transpose ( shape_3d_chunks_blocks , dtype_fixture , axes ):
119
- shape , chunks , blocks = shape_3d_chunks_blocks
118
+ def test_3d_permute_dims ( shape_chunks_blocks_3d , dtype_fixture , axes ):
119
+ shape , chunks , blocks = shape_chunks_blocks_3d
120
120
a = blosc2 .linspace (0 , 1 , shape = shape , chunks = chunks , blocks = blocks , dtype = dtype_fixture )
121
121
at = blosc2 .permute_dims (a , axes = axes )
122
122
@@ -130,8 +130,8 @@ def test_3d_transpose(shape_3d_chunks_blocks, dtype_fixture, axes):
130
130
"axes" ,
131
131
list (permutations ([0 , 1 , 2 , 3 ])),
132
132
)
133
- def test_4d_transpose ( shape_4d_chunks_blocks , dtype_fixture , axes ):
134
- shape , chunks , blocks = shape_4d_chunks_blocks
133
+ def test_4d_permute_dims ( shape_chunks_blocks_4d , dtype_fixture , axes ):
134
+ shape , chunks , blocks = shape_chunks_blocks_4d
135
135
a = blosc2 .linspace (0 , 1 , shape = shape , chunks = chunks , blocks = blocks , dtype = dtype_fixture )
136
136
at = blosc2 .permute_dims (a , axes = axes )
137
137
@@ -150,8 +150,8 @@ def test_4d_transpose(shape_4d_chunks_blocks, dtype_fixture, axes):
150
150
"dtype" ,
151
151
{np .complex64 , np .complex128 },
152
152
)
153
- def test_complex (shape_3d_chunks_blocks , dtype , axes ):
154
- shape , chunks , blocks = shape_3d_chunks_blocks
153
+ def test_complex (shape_chunks_blocks_3d , dtype , axes ):
154
+ shape , chunks , blocks = shape_chunks_blocks_3d
155
155
real_part = blosc2 .linspace (0 , 1 , shape = shape , chunks = chunks , blocks = blocks , dtype = dtype )
156
156
imag_part = blosc2 .linspace (1 , 0 , shape = shape , chunks = chunks , blocks = blocks , dtype = dtype )
157
157
complex_matrix = real_part + 3j * imag_part
@@ -176,8 +176,8 @@ def test_complex(shape_3d_chunks_blocks, dtype, axes):
176
176
(0 , - 4 , 1 ),
177
177
],
178
178
)
179
- def test_invalid_axes_raises (shape_3d_chunks_blocks , axes ):
180
- shape , chunks , blocks = shape_3d_chunks_blocks
179
+ def test_invalid_axes_raises (shape_chunks_blocks_3d , axes ):
180
+ shape , chunks , blocks = shape_chunks_blocks_3d
181
181
a = blosc2 .linspace (0 , 1 , shape = shape , chunks = chunks , blocks = blocks )
182
182
183
183
with pytest .raises (ValueError , match = "not a valid permutation" ):
@@ -186,11 +186,7 @@ def test_invalid_axes_raises(shape_3d_chunks_blocks, axes):
186
186
187
187
@pytest .mark .parametrize (
188
188
"shape" ,
189
- [
190
- (2 , 3 ),
191
- (4 , 5 , 6 ),
192
- (2 , 4 , 8 , 5 ),
193
- ],
189
+ [(2 , 3 ), (4 , 5 , 6 ), (2 , 4 , 8 , 5 ), (7 , 3 , 9 , 9 , 5 )],
194
190
)
195
191
def test_matrix_transpose (shape ):
196
192
arr = blosc2 .linspace (0 , 1 , shape = shape )
@@ -223,13 +219,12 @@ def test_disk():
223
219
nc = np .transpose (na )
224
220
225
221
np .testing .assert_allclose (c , nc , rtol = 1e-6 )
226
-
227
222
blosc2 .remove_urlpath ("a_test.b2nd" )
228
223
blosc2 .remove_urlpath ("c_test.b2nd" )
229
224
230
225
231
- def test_transpose (shape_2d_chunks_blocks , dtype_fixture ):
232
- shape , chunks , blocks = shape_2d_chunks_blocks
226
+ def test_transpose (shape_chunks_blocks_2d , dtype_fixture ):
227
+ shape , chunks , blocks = shape_chunks_blocks_2d
233
228
a = blosc2 .linspace (0 , 1 , shape = shape , chunks = chunks , blocks = blocks , dtype = dtype_fixture )
234
229
with pytest .warns (DeprecationWarning ):
235
230
at = blosc2 .transpose (a )
0 commit comments