Skip to content

Commit b938b71

Browse files
committed
Add explicit byteorder on hexdigest tests.
Fixes zarr-developers#425.
1 parent 3ddd1c5 commit b938b71

2 files changed

Lines changed: 57 additions & 57 deletions

File tree

‎zarr/tests/test_core.py‎

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def test_array_init(self):
4848

4949
# normal initialization
5050
store = dict()
51-
init_array(store, shape=100, chunks=10)
51+
init_array(store, shape=100, chunks=10, dtype='<f8')
5252
a = Array(store)
5353
assert isinstance(a, Array)
5454
assert (100,) == a.shape
@@ -61,7 +61,7 @@ def test_array_init(self):
6161

6262
# initialize at path
6363
store = dict()
64-
init_array(store, shape=100, chunks=10, path='foo/bar')
64+
init_array(store, shape=100, chunks=10, path='foo/bar', dtype='<f8')
6565
a = Array(store, path='foo/bar')
6666
assert isinstance(a, Array)
6767
assert (100,) == a.shape
@@ -504,24 +504,24 @@ def test_setitem_data_not_shared(self):
504504

505505
def test_hexdigest(self):
506506
# Check basic 1-D array
507-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
507+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
508508
assert '063b02ff8d9d3bab6da932ad5828b506ef0a6578' == z.hexdigest()
509509

510510
# Check basic 1-D array with different type
511-
z = self.create_array(shape=(1050,), chunks=100, dtype='f4')
511+
z = self.create_array(shape=(1050,), chunks=100, dtype='<f4')
512512
assert 'f97b84dc9ffac807415f750100108764e837bb82' == z.hexdigest()
513513

514514
# Check basic 2-D array
515-
z = self.create_array(shape=(20, 35,), chunks=10, dtype='i4')
515+
z = self.create_array(shape=(20, 35,), chunks=10, dtype='<i4')
516516
assert '4f797d7bdad0fa1c9fa8c80832efb891a68de104' == z.hexdigest()
517517

518518
# Check basic 1-D array with some data
519-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
519+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
520520
z[200:400] = np.arange(200, 400, dtype='i4')
521521
assert '14470724dca6c1837edddedc490571b6a7f270bc' == z.hexdigest()
522522

523523
# Check basic 1-D array with attributes
524-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
524+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
525525
z.attrs['foo'] = 'bar'
526526
assert '2a1046dd99b914459b3e86be9dde05027a07d209' == z.hexdigest()
527527

@@ -1294,24 +1294,24 @@ def create_array(read_only=False, **kwargs):
12941294

12951295
def test_hexdigest(self):
12961296
# Check basic 1-D array
1297-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1297+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
12981298
assert 'f710da18d45d38d4aaf2afd7fb822fdd73d02957' == z.hexdigest()
12991299

13001300
# Check basic 1-D array with different type
1301-
z = self.create_array(shape=(1050,), chunks=100, dtype='f4')
1301+
z = self.create_array(shape=(1050,), chunks=100, dtype='<f4')
13021302
assert '1437428e69754b1e1a38bd7fc9e43669577620db' == z.hexdigest()
13031303

13041304
# Check basic 2-D array
1305-
z = self.create_array(shape=(20, 35,), chunks=10, dtype='i4')
1305+
z = self.create_array(shape=(20, 35,), chunks=10, dtype='<i4')
13061306
assert 'dde44c72cc530bd6aae39b629eb15a2da627e5f9' == z.hexdigest()
13071307

13081308
# Check basic 1-D array with some data
1309-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1309+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
13101310
z[200:400] = np.arange(200, 400, dtype='i4')
13111311
assert '4c0a76fb1222498e09dcd92f7f9221d6cea8b40e' == z.hexdigest()
13121312

13131313
# Check basic 1-D array with attributes
1314-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1314+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
13151315
z.attrs['foo'] = 'bar'
13161316
assert '05b0663ffe1785f38d3a459dec17e57a18f254af' == z.hexdigest()
13171317

@@ -1349,24 +1349,24 @@ def create_array(read_only=False, **kwargs):
13491349

13501350
def test_hexdigest(self):
13511351
# Check basic 1-D array
1352-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1352+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
13531353
assert 'f710da18d45d38d4aaf2afd7fb822fdd73d02957' == z.hexdigest()
13541354

13551355
# Check basic 1-D array with different type
1356-
z = self.create_array(shape=(1050,), chunks=100, dtype='f4')
1356+
z = self.create_array(shape=(1050,), chunks=100, dtype='<f4')
13571357
assert '1437428e69754b1e1a38bd7fc9e43669577620db' == z.hexdigest()
13581358

13591359
# Check basic 2-D array
1360-
z = self.create_array(shape=(20, 35,), chunks=10, dtype='i4')
1360+
z = self.create_array(shape=(20, 35,), chunks=10, dtype='<i4')
13611361
assert 'dde44c72cc530bd6aae39b629eb15a2da627e5f9' == z.hexdigest()
13621362

13631363
# Check basic 1-D array with some data
1364-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1364+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
13651365
z[200:400] = np.arange(200, 400, dtype='i4')
13661366
assert '4c0a76fb1222498e09dcd92f7f9221d6cea8b40e' == z.hexdigest()
13671367

13681368
# Check basic 1-D array with attributes
1369-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1369+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
13701370
z.attrs['foo'] = 'bar'
13711371
assert '05b0663ffe1785f38d3a459dec17e57a18f254af' == z.hexdigest()
13721372

@@ -1705,24 +1705,24 @@ def test_compressors(self):
17051705

17061706
def test_hexdigest(self):
17071707
# Check basic 1-D array
1708-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1708+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
17091709
assert 'c6b83adfad999fbd865057531d749d87cf138f58' == z.hexdigest()
17101710

17111711
# Check basic 1-D array with different type
1712-
z = self.create_array(shape=(1050,), chunks=100, dtype='f4')
1712+
z = self.create_array(shape=(1050,), chunks=100, dtype='<f4')
17131713
assert 'a3d6d187536ecc3a9dd6897df55d258e2f52f9c5' == z.hexdigest()
17141714

17151715
# Check basic 2-D array
1716-
z = self.create_array(shape=(20, 35,), chunks=10, dtype='i4')
1716+
z = self.create_array(shape=(20, 35,), chunks=10, dtype='<i4')
17171717
assert '189690c5701d33a41cd7ce9aa0ac8dac49a69c51' == z.hexdigest()
17181718

17191719
# Check basic 1-D array with some data
1720-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1720+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
17211721
z[200:400] = np.arange(200, 400, dtype='i4')
17221722
assert 'b63f031031dcd5248785616edcb2d6fe68203c28' == z.hexdigest()
17231723

17241724
# Check basic 1-D array with attributes
1725-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1725+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
17261726
z.attrs['foo'] = 'bar'
17271727
assert '0cfc673215a8292a87f3c505e2402ce75243c601' == z.hexdigest()
17281728

@@ -1855,24 +1855,24 @@ def create_array(self, read_only=False, **kwargs):
18551855

18561856
def test_hexdigest(self):
18571857
# Check basic 1-D array
1858-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1858+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
18591859
assert 'd3da3d485de4a5fcc6d91f9dfc6a7cba9720c561' == z.hexdigest()
18601860

18611861
# Check basic 1-D array with different type
1862-
z = self.create_array(shape=(1050,), chunks=100, dtype='f4')
1862+
z = self.create_array(shape=(1050,), chunks=100, dtype='<f4')
18631863
assert '443b8dee512e42946cb63ff01d28e9bee8105a5f' == z.hexdigest()
18641864

18651865
# Check basic 2-D array
1866-
z = self.create_array(shape=(20, 35,), chunks=10, dtype='i4')
1866+
z = self.create_array(shape=(20, 35,), chunks=10, dtype='<i4')
18671867
assert 'de841ca276042993da53985de1e7769f5d0fc54d' == z.hexdigest()
18681868

18691869
# Check basic 1-D array with some data
1870-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1870+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
18711871
z[200:400] = np.arange(200, 400, dtype='i4')
18721872
assert '42b6ae0d50ec361628736ab7e68fe5fefca22136' == z.hexdigest()
18731873

18741874
# Check basic 1-D array with attributes
1875-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1875+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
18761876
z.attrs['foo'] = 'bar'
18771877
assert 'a0535f31c130f5e5ac66ba0713d1c1ceaebd089b' == z.hexdigest()
18781878

@@ -1891,24 +1891,24 @@ def create_array(self, read_only=False, **kwargs):
18911891

18921892
def test_hexdigest(self):
18931893
# Check basic 1-D array
1894-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1894+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
18951895
assert '33141032439fb1df5e24ad9891a7d845b6c668c8' == z.hexdigest()
18961896

18971897
# Check basic 1-D array with different type
1898-
z = self.create_array(shape=(1050,), chunks=100, dtype='f4')
1898+
z = self.create_array(shape=(1050,), chunks=100, dtype='<f4')
18991899
assert '44d719da065c88a412d609a5500ff41e07b331d6' == z.hexdigest()
19001900

19011901
# Check basic 2-D array
1902-
z = self.create_array(shape=(20, 35,), chunks=10, dtype='i4')
1902+
z = self.create_array(shape=(20, 35,), chunks=10, dtype='<i4')
19031903
assert 'f57a9a73a4004490fe1b871688651b8a298a5db7' == z.hexdigest()
19041904

19051905
# Check basic 1-D array with some data
1906-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1906+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
19071907
z[200:400] = np.arange(200, 400, dtype='i4')
19081908
assert '1e1bcaac63e4ef3c4a68f11672537131c627f168' == z.hexdigest()
19091909

19101910
# Check basic 1-D array with attributes
1911-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1911+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
19121912
z.attrs['foo'] = 'bar'
19131913
assert '86d7b9bf22dccbeaa22f340f38be506b55e76ff2' == z.hexdigest()
19141914

@@ -1927,24 +1927,24 @@ def create_array(self, read_only=False, **kwargs):
19271927

19281928
def test_hexdigest(self):
19291929
# Check basic 1-D array
1930-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1930+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
19311931
assert '7ff2ae8511eac915fad311647c168ccfe943e788' == z.hexdigest()
19321932

19331933
# Check basic 1-D array with different type
1934-
z = self.create_array(shape=(1050,), chunks=100, dtype='f4')
1934+
z = self.create_array(shape=(1050,), chunks=100, dtype='<f4')
19351935
assert '962705c861863495e9ccb7be7735907aa15e85b5' == z.hexdigest()
19361936

19371937
# Check basic 2-D array
1938-
z = self.create_array(shape=(20, 35,), chunks=10, dtype='i4')
1938+
z = self.create_array(shape=(20, 35,), chunks=10, dtype='<i4')
19391939
assert 'deb675ff91dd26dba11b65aab5f19a1f21a5645b' == z.hexdigest()
19401940

19411941
# Check basic 1-D array with some data
1942-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1942+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
19431943
z[200:400] = np.arange(200, 400, dtype='i4')
19441944
assert '90e30bdab745a9641cd0eb605356f531bc8ec1c3' == z.hexdigest()
19451945

19461946
# Check basic 1-D array with attributes
1947-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1947+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
19481948
z.attrs['foo'] = 'bar'
19491949
assert '95d40c391f167db8b1290e3c39d9bf741edacdf6' == z.hexdigest()
19501950

@@ -1970,24 +1970,24 @@ def create_array(self, read_only=False, **kwargs):
19701970

19711971
def test_hexdigest(self):
19721972
# Check basic 1-D array
1973-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1973+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
19741974
assert '93ecaa530a1162a9d48a3c1dcee4586ccfc59bae' == z.hexdigest()
19751975

19761976
# Check basic 1-D array with different type
1977-
z = self.create_array(shape=(1050,), chunks=100, dtype='f4')
1977+
z = self.create_array(shape=(1050,), chunks=100, dtype='<f4')
19781978
assert '04a9755a0cd638683531b7816c7fa4fbb6f577f2' == z.hexdigest()
19791979

19801980
# Check basic 2-D array
1981-
z = self.create_array(shape=(20, 35,), chunks=10, dtype='i4')
1981+
z = self.create_array(shape=(20, 35,), chunks=10, dtype='<i4')
19821982
assert 'b93b163a21e8500519250a6defb821d03eb5d9e0' == z.hexdigest()
19831983

19841984
# Check basic 1-D array with some data
1985-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1985+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
19861986
z[200:400] = np.arange(200, 400, dtype='i4')
19871987
assert 'cde499f3dc945b4e97197ff8e3cf8188a1262c35' == z.hexdigest()
19881988

19891989
# Check basic 1-D array with attributes
1990-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
1990+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
19911991
z.attrs['foo'] = 'bar'
19921992
assert 'e2cf3afbf66ad0e28a2b6b68b1b07817c69aaee2' == z.hexdigest()
19931993

@@ -2013,24 +2013,24 @@ def create_array(read_only=False, **kwargs):
20132013

20142014
def test_hexdigest(self):
20152015
# Check basic 1-D array
2016-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
2016+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
20172017
assert 'b80367c5599d47110d42bd8886240c2f46620dba' == z.hexdigest()
20182018

20192019
# Check basic 1-D array with different type
2020-
z = self.create_array(shape=(1050,), chunks=100, dtype='f4')
2020+
z = self.create_array(shape=(1050,), chunks=100, dtype='<f4')
20212021
assert '95a7b2471225e73199c9716d21e8d3dd6e5f6f2a' == z.hexdigest()
20222022

20232023
# Check basic 2-D array
2024-
z = self.create_array(shape=(20, 35,), chunks=10, dtype='i4')
2024+
z = self.create_array(shape=(20, 35,), chunks=10, dtype='<i4')
20252025
assert '9abf3ad54413ab11855d88a5e0087cd416657e02' == z.hexdigest()
20262026

20272027
# Check basic 1-D array with some data
2028-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
2028+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
20292029
z[200:400] = np.arange(200, 400, dtype='i4')
20302030
assert 'c649ad229bc5720258b934ea958570c2f354c2eb' == z.hexdigest()
20312031

20322032
# Check basic 1-D array with attributes
2033-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
2033+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
20342034
z.attrs['foo'] = 'bar'
20352035
assert '62fc9236d78af18a5ec26c12eea1d33bce52501e' == z.hexdigest()
20362036

‎zarr/tests/test_sync.py‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,24 +115,24 @@ def create_pool(self):
115115

116116
def test_hexdigest(self):
117117
# Check basic 1-D array
118-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
118+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
119119
assert 'f710da18d45d38d4aaf2afd7fb822fdd73d02957' == z.hexdigest()
120120

121121
# Check basic 1-D array with different type
122-
z = self.create_array(shape=(1050,), chunks=100, dtype='f4')
122+
z = self.create_array(shape=(1050,), chunks=100, dtype='<f4')
123123
assert '1437428e69754b1e1a38bd7fc9e43669577620db' == z.hexdigest()
124124

125125
# Check basic 2-D array
126-
z = self.create_array(shape=(20, 35,), chunks=10, dtype='i4')
126+
z = self.create_array(shape=(20, 35,), chunks=10, dtype='<i4')
127127
assert 'dde44c72cc530bd6aae39b629eb15a2da627e5f9' == z.hexdigest()
128128

129129
# Check basic 1-D array with some data
130-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
130+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
131131
z[200:400] = np.arange(200, 400, dtype='i4')
132132
assert '4c0a76fb1222498e09dcd92f7f9221d6cea8b40e' == z.hexdigest()
133133

134134
# Check basic 1-D array with attributes
135-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
135+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
136136
z.attrs['foo'] = 'bar'
137137
assert '05b0663ffe1785f38d3a459dec17e57a18f254af' == z.hexdigest()
138138

@@ -159,24 +159,24 @@ def create_pool(self):
159159

160160
def test_hexdigest(self):
161161
# Check basic 1-D array
162-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
162+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
163163
assert 'f710da18d45d38d4aaf2afd7fb822fdd73d02957' == z.hexdigest()
164164

165165
# Check basic 1-D array with different type
166-
z = self.create_array(shape=(1050,), chunks=100, dtype='f4')
166+
z = self.create_array(shape=(1050,), chunks=100, dtype='<f4')
167167
assert '1437428e69754b1e1a38bd7fc9e43669577620db' == z.hexdigest()
168168

169169
# Check basic 2-D array
170-
z = self.create_array(shape=(20, 35,), chunks=10, dtype='i4')
170+
z = self.create_array(shape=(20, 35,), chunks=10, dtype='<i4')
171171
assert 'dde44c72cc530bd6aae39b629eb15a2da627e5f9' == z.hexdigest()
172172

173173
# Check basic 1-D array with some data
174-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
174+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
175175
z[200:400] = np.arange(200, 400, dtype='i4')
176176
assert '4c0a76fb1222498e09dcd92f7f9221d6cea8b40e' == z.hexdigest()
177177

178178
# Check basic 1-D array with attributes
179-
z = self.create_array(shape=(1050,), chunks=100, dtype='i4')
179+
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
180180
z.attrs['foo'] = 'bar'
181181
assert '05b0663ffe1785f38d3a459dec17e57a18f254af' == z.hexdigest()
182182

0 commit comments

Comments
 (0)