File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1515from zarr .array import Array
1616from zarr .buffer import Buffer , BufferPrototype , NDBuffer
1717from zarr .common import ChunkCoords
18+ from zarr .group import Group
1819from zarr .indexing import (
1920 BasicSelection ,
2021 make_slice_selection ,
@@ -1815,3 +1816,26 @@ def test_orthogonal_bool_indexing_like_numpy_ix(
18151816 # note: in python 3.10 z[*selection] is not valid unpacking syntax
18161817 actual = z [(* selection ,)]
18171818 assert_array_equal (expected , actual , err_msg = f"{ selection = } " )
1819+
1820+
1821+ def test_indexing_after_close (store : StorePath ) -> None :
1822+ """
1823+ Test that data is persisted after calling store.close, and subsequently invoking array[:].
1824+ Bug discovered here: https://github.com/zarr-developers/zarr-python/pull/1746#issuecomment-2269562717
1825+ """
1826+ root = Group .create (store )
1827+ value = 1
1828+ nparray = np .array ([value ], dtype = np .int8 )
1829+
1830+ a = root .create_array (
1831+ "/0/0" ,
1832+ shape = nparray .shape ,
1833+ chunks = (1 ,),
1834+ dtype = nparray .dtype .str ,
1835+ attributes = {},
1836+ fill_value = nparray .dtype .type (0 ),
1837+ )
1838+ a [:] = nparray
1839+ assert a [:] == value
1840+ store .store .close ()
1841+ assert a [:] == value
You can’t perform that action at this time.
0 commit comments