@@ -866,27 +866,6 @@ async def test_special_complex_fill_values_roundtrip(fill_value: Any, expected:
866866 assert actual ["fill_value" ] == expected
867867
868868
869- async def test_creation_from_other_zarr (tmpdir ):
870- src = zarr .zeros (
871- (2000 , 20000 ), chunks = (1000 , 1000 ), dtype = "uint8" , store = LocalStore (str (tmpdir ))
872- )
873- src [:] = 1
874- for _i in range (10 ):
875- start_time = time .time ()
876- c = zarr .array (src , store = MemoryStore ())
877- end_time = time .time ()
878- print (f"Time fast: { end_time - start_time } seconds" )
879-
880- start_time = time .time ()
881- b = zarr .zeros (src .shape , chunks = src .chunks , store = MemoryStore ())
882- b [:] = src [:]
883- end_time = time .time ()
884- print (f"Time slow: { end_time - start_time } seconds" )
885-
886- assert b [123 , 123 ] == 1
887- assert c [123 , 123 ] == 1
888-
889-
890869@pytest .mark .parametrize ("shape" , [(1 ,), (2 , 3 ), (4 , 5 , 6 )])
891870@pytest .mark .parametrize ("dtype" , ["uint8" , "float32" ])
892871@pytest .mark .parametrize ("array_type" , ["async" , "sync" ])
@@ -912,26 +891,22 @@ async def test_scalar_array() -> None:
912891 assert arr .shape == ()
913892
914893
915- @pytest .mark .parametrize ("shape" , [(1 ,), (2 , 3 ), (4 , 5 , 6 )])
916- @pytest .mark .parametrize ("dtype" , ["uint8" , "float32" ])
917- @pytest .mark .parametrize ("array_type" , ["async" , "sync" ])
918- async def test_nbytes (
919- shape : tuple [int , ...], dtype : str , array_type : Literal ["async" , "sync" ]
920- ) -> None :
921- """
922- Test that the ``nbytes`` attribute of an Array or AsyncArray correctly reports the capacity of
923- the chunks of that array.
924- """
925- store = MemoryStore ()
926- arr = Array .create (store = store , shape = shape , dtype = dtype , fill_value = 0 )
927- if array_type == "async" :
928- assert arr ._async_array .nbytes == np .prod (arr .shape ) * arr .dtype .itemsize
929- else :
930- assert arr .nbytes == np .prod (arr .shape ) * arr .dtype .itemsize
894+ async def test_creation_from_other_zarr (tmpdir ):
895+ src = zarr .zeros (
896+ (2000 , 20000 ), chunks = (1000 , 1000 ), dtype = "uint8" , store = LocalStore (str (tmpdir ))
897+ )
898+ src [:] = 1
899+ for _i in range (10 ):
900+ start_time = time .time ()
901+ c = zarr .array (src , store = MemoryStore ())
902+ end_time = time .time ()
903+ print (f"Time fast: { end_time - start_time } seconds" )
931904
905+ start_time = time .time ()
906+ b = zarr .zeros (src .shape , chunks = src .chunks , store = MemoryStore ())
907+ b [:] = src [:]
908+ end_time = time .time ()
909+ print (f"Time slow: { end_time - start_time } seconds" )
932910
933- async def test_scalar_array () -> None :
934- arr = zarr .array (1.5 )
935- assert arr [...] == 1.5
936- assert arr [()] == 1.5
937- assert arr .shape == ()
911+ assert b [123 , 123 ] == 1
912+ assert c [123 , 123 ] == 1
0 commit comments