Skip to content

Commit c2ea055

Browse files
committed
Reject patch if data type does not match.
1 parent ce7c7c7 commit c2ea055

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

tiled/_tests/test_writing.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ def test_extend_array(tree):
169169
ac.patch(ones * 8, offset=8, extend=True)
170170
numpy.testing.assert_equal(ac[8:9], ones * 8)
171171

172+
with fail_with_status_code(HTTP_409_CONFLICT):
173+
ac.patch(ones.astype("uint8"), offset=9, extend=True)
174+
172175

173176
def test_write_dataframe_full(tree):
174177
with Context.from_app(

tiled/adapters/zarr.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ async def patch(
206206
If slice does not fit wholly with the shape of the existing array
207207
and expand is False
208208
"""
209+
if data.dtype != self._array.dtype:
210+
raise Conflicts(
211+
f"Patch data type {data.dtype} does not match array data type "
212+
f"{self._array.dtype}."
213+
)
209214
current_shape = self._array.shape
210215
normalized_offset = [0] * len(current_shape)
211216
normalized_offset[: len(offset)] = list(offset)

0 commit comments

Comments
 (0)