diff --git a/zarr/creation.py b/zarr/creation.py index 7e7adcb157..4f68c7cd1c 100644 --- a/zarr/creation.py +++ b/zarr/creation.py @@ -16,7 +16,7 @@ def create(shape, chunks=True, dtype=None, compressor='default', - fill_value=0, order='C', store=None, synchronizer=None, + fill_value=None, order='C', store=None, synchronizer=None, overwrite=False, path=None, chunk_store=None, filters=None, cache_metadata=True, cache_attrs=True, read_only=False, object_codec=None, dimension_separator=None, diff --git a/zarr/tests/test_core.py b/zarr/tests/test_core.py index 7423132887..8196b80904 100644 --- a/zarr/tests/test_core.py +++ b/zarr/tests/test_core.py @@ -18,6 +18,7 @@ from pkg_resources import parse_version from zarr.core import Array +from zarr.creation import create from zarr.meta import json_loads from zarr.n5 import N5Store, N5FSStore, n5_keywords from zarr.storage import ( @@ -1249,6 +1250,14 @@ def test_object_arrays_vlen_bytes(self): assert_array_equal(data, z[:]) z.store.close() + # Zero-length bytes + z = create(shape=(1,), dtype=bytes) + assert z.dtype == object + assert isinstance(z.filters[0], VLenBytes) + z[0] = b'' + assert z[0] == b'' + z.store.close() + z = self.create_array(shape=data.shape, dtype=object, object_codec=Pickle()) z[:] = data assert_array_equal(data, z[:]) diff --git a/zarr/tests/test_creation.py b/zarr/tests/test_creation.py index 0ec551ba4e..2fab7c9ac4 100644 --- a/zarr/tests/test_creation.py +++ b/zarr/tests/test_creation.py @@ -433,7 +433,7 @@ def test_create(): assert (100,) == z.chunks # auto-chunks assert np.dtype(None) == z.dtype assert 'blosc' == z.compressor.codec_id - assert 0 == z.fill_value + assert None == z.fill_value # all specified z = create(100, chunks=10, dtype='i4', compressor=Zlib(1), diff --git a/zarr/tests/test_storage.py b/zarr/tests/test_storage.py index e85973b524..d6ba53d169 100644 --- a/zarr/tests/test_storage.py +++ b/zarr/tests/test_storage.py @@ -2207,7 +2207,7 @@ def test_read_write(self): def test_fill_value_change(): - a = zarr.create((10, 10), dtype=int) + a = zarr.create((10, 10), dtype=int, fill_value=0) assert a[0, 0] == 0