Skip to content

Commit baf1315

Browse files
committed
Correct default fill_value for creation.create
1 parent a81de6b commit baf1315

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

zarr/creation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
def create(shape, chunks=True, dtype=None, compressor='default',
19-
fill_value=0, order='C', store=None, synchronizer=None,
19+
fill_value=None, order='C', store=None, synchronizer=None,
2020
overwrite=False, path=None, chunk_store=None, filters=None,
2121
cache_metadata=True, cache_attrs=True, read_only=False,
2222
object_codec=None, dimension_separator=None,

zarr/tests/test_core.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from pkg_resources import parse_version
1919

2020
from zarr.core import Array
21+
from zarr.creation import create
2122
from zarr.meta import json_loads
2223
from zarr.n5 import N5Store, N5FSStore, n5_keywords
2324
from zarr.storage import (
@@ -1249,6 +1250,14 @@ def test_object_arrays_vlen_bytes(self):
12491250
assert_array_equal(data, z[:])
12501251
z.store.close()
12511252

1253+
# Zero-length bytes
1254+
z = create(shape=(1,), dtype=bytes)
1255+
assert z.dtype == object
1256+
assert isinstance(z.filters[0], VLenBytes)
1257+
z[0] = b''
1258+
assert z[0] == b''
1259+
z.store.close()
1260+
12521261
z = self.create_array(shape=data.shape, dtype=object, object_codec=Pickle())
12531262
z[:] = data
12541263
assert_array_equal(data, z[:])

0 commit comments

Comments
 (0)