13
13
# mix of dtypes: integer, float
14
14
# mix of shapes: 1D, 2D, 3D
15
15
# mix of orders: C, F
16
+ # mix of encoding types: All available types for each arrays
16
17
arrays = [
17
- np .random .randint (0 , 1 , size = 110 , dtype = '?' ).reshape (10 , 11 ),
18
- np .arange (1000 , dtype = '<i4' ),
19
- np .linspace (1000 , 1001 , 1000 , dtype = '<f4' ).reshape (100 , 10 ),
20
- np .random .normal (loc = 1000 , scale = 1 , size = (10 , 10 , 10 )).astype ('<f8' ),
21
- np .random .randint (0 , 200 , size = 1000 , dtype = 'u2' ).astype ('<u2' ).reshape (100 , 10 , order = 'F' ),
18
+ ( np .random .randint (0 , 1 , size = 110 , dtype = '?' ).reshape (10 , 11 ), ( '?' , '<u1' , '<i1' ) ),
19
+ ( np .arange (1000 , dtype = '<i4' ), ( '<i4' , '<i2' , '<u4' , 'u2' ) ),
20
+ ( np .linspace (1000 , 1001 , 1000 , dtype = '<f4' ).reshape (100 , 10 ), ( '<f4' ,) ),
21
+ ( np .random .normal (loc = 1000 , scale = 1 , size = (10 , 10 , 10 )).astype ('<f8' ), ( '<f8' ,) ),
22
+ ( np .random .randint (0 , 200 , size = 1000 , dtype = 'u2' ).astype ('<u2' ).reshape (100 , 10 , order = 'F' ), ( '<i2' ,) ),
22
23
]
23
24
24
-
25
25
def test_encode_decode ():
26
- for arr in arrays :
27
- codec = Delta (dtype = arr .dtype )
28
- check_encode_decode (arr , codec )
26
+ for arr , encoding_types in arrays :
27
+ for astype in encoding_types :
28
+ codec = Delta (dtype = arr .dtype , astype = astype )
29
+ check_encode_decode (arr , codec )
29
30
30
31
31
32
def test_encode ():
@@ -49,7 +50,7 @@ def test_repr():
49
50
50
51
51
52
def test_backwards_compatibility ():
52
- for arr in arrays :
53
+ for arr , _ in arrays :
53
54
codec = Delta (dtype = arr .dtype )
54
55
check_backwards_compatibility (Delta .codec_id , [arr ], [codec ], prefix = str (arr .dtype ))
55
56
0 commit comments