Skip to content

Commit 5185cee

Browse files
committed
More hexdigest updates
1 parent e46ad54 commit 5185cee

File tree

1 file changed

+36
-10
lines changed

1 file changed

+36
-10
lines changed

zarr/tests/test_core.py

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,28 +2479,41 @@ def create_array(read_only=False, **kwargs):
24792479
return Array(store, read_only=read_only, cache_metadata=cache_metadata,
24802480
cache_attrs=cache_attrs)
24812481

2482+
def expected(self):
2483+
return [
2484+
"ab753fc81df0878589535ca9bad2816ba88d91bc",
2485+
"c16261446f9436b1e9f962e57ce3e8f6074abe8a",
2486+
"c2ef3b2fb2bc9dcace99cd6dad1a7b66cc1ea058",
2487+
"6e52f95ac15b164a8e96843a230fcee0e610729b",
2488+
"091fa99bc60706095c9ce30b56ce2503e0223f56",
2489+
]
2490+
24822491
def test_hexdigest(self):
2492+
found = []
2493+
24832494
# Check basic 1-D array
24842495
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
2485-
assert 'f710da18d45d38d4aaf2afd7fb822fdd73d02957' == z.hexdigest()
2496+
found.append(z.hexdigest())
24862497

24872498
# Check basic 1-D array with different type
24882499
z = self.create_array(shape=(1050,), chunks=100, dtype='<f4')
2489-
assert '1437428e69754b1e1a38bd7fc9e43669577620db' == z.hexdigest()
2500+
found.append(z.hexdigest())
24902501

24912502
# Check basic 2-D array
24922503
z = self.create_array(shape=(20, 35,), chunks=10, dtype='<i4')
2493-
assert '6c530b6b9d73e108cc5ee7b6be3d552cc994bdbe' == z.hexdigest()
2504+
found.append(z.hexdigest())
24942505

24952506
# Check basic 1-D array with some data
24962507
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
24972508
z[200:400] = np.arange(200, 400, dtype='i4')
2498-
assert '4c0a76fb1222498e09dcd92f7f9221d6cea8b40e' == z.hexdigest()
2509+
found.append(z.hexdigest())
24992510

25002511
# Check basic 1-D array with attributes
25012512
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
25022513
z.attrs['foo'] = 'bar'
2503-
assert '05b0663ffe1785f38d3a459dec17e57a18f254af' == z.hexdigest()
2514+
found.append(z.hexdigest())
2515+
2516+
assert self.expected() == found
25042517

25052518

25062519
@pytest.mark.skipif(have_fsspec is False, reason="needs fsspec")
@@ -2579,6 +2592,7 @@ def test_read_from_all_blocks(self):
25792592

25802593
@pytest.mark.skipif(have_fsspec is False, reason="needs fsspec")
25812594
class TestArrayWithFSStoreNested(TestArray):
2595+
25822596
@staticmethod
25832597
def create_array(read_only=False, **kwargs):
25842598
path = mkdtemp()
@@ -2592,29 +2606,41 @@ def create_array(read_only=False, **kwargs):
25922606
return Array(store, read_only=read_only, cache_metadata=cache_metadata,
25932607
cache_attrs=cache_attrs)
25942608

2609+
def expected(self):
2610+
return [
2611+
"94884f29b41b9beb8fc99ad7bf9c0cbf0f2ab3c9",
2612+
"077aa3bd77b8d354f8f6c15dce5ae4f545788a72",
2613+
"22be95d83c097460adb339d80b2d7fe19c513c16",
2614+
"85131cec526fa46938fd2c4a6083a58ee11037ea",
2615+
"c3167010c162c6198cb2bf3c1da2c46b047c69a1",
2616+
]
2617+
25952618
def test_hexdigest(self):
2619+
found = []
2620+
25962621
# Check basic 1-D array
25972622
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
2598-
assert 'f710da18d45d38d4aaf2afd7fb822fdd73d02957' == z.hexdigest()
2623+
found.append(z.hexdigest())
25992624

26002625
# Check basic 1-D array with different type
26012626
z = self.create_array(shape=(1050,), chunks=100, dtype='<f4')
2602-
assert '1437428e69754b1e1a38bd7fc9e43669577620db' == z.hexdigest()
2627+
found.append(z.hexdigest())
26032628

26042629
# Check basic 2-D array
26052630
z = self.create_array(shape=(20, 35,), chunks=10, dtype='<i4')
2606-
assert '6c530b6b9d73e108cc5ee7b6be3d552cc994bdbe' == z.hexdigest()
2631+
found.append(z.hexdigest())
26072632

26082633
# Check basic 1-D array with some data
26092634
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
26102635
z[200:400] = np.arange(200, 400, dtype='i4')
2611-
assert '4c0a76fb1222498e09dcd92f7f9221d6cea8b40e' == z.hexdigest()
2636+
found.append(z.hexdigest())
26122637

26132638
# Check basic 1-D array with attributes
26142639
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
26152640
z.attrs['foo'] = 'bar'
2616-
assert '05b0663ffe1785f38d3a459dec17e57a18f254af' == z.hexdigest()
2641+
found.append(z.hexdigest())
26172642

2643+
assert self.expected() == found
26182644

26192645
@pytest.mark.skipif(have_fsspec is False, reason="needs fsspec")
26202646
class TestArrayWithFSStoreNestedPartialRead(TestArray):

0 commit comments

Comments
 (0)