Skip to content

Commit 149f4a0

Browse files
committed
Test overwrite and out-of-order updates.
1 parent bc55357 commit 149f4a0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tiled/_tests/test_writing.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,22 @@ def test_extend_array(tree):
149149
assert actual.shape == full_array.shape
150150
numpy.testing.assert_equal(actual, full_array)
151151

152+
# Overwrite data (do not extend).
153+
revised_data = numpy.ones((1, 2, 2)) * 3
154+
revised_array = full_array.copy()
155+
revised_array[3, :, :] = 3
156+
ac.patch(revised_data, slice=slice(3, 4))
157+
numpy.testing.assert_equal(ac.read(), revised_array)
158+
159+
# Extend out of order.
160+
ones = numpy.ones((1, 2, 2))
161+
ac.patch(ones * 7, slice=slice(7, 8), extend=True)
162+
ac.patch(ones * 5, slice=slice(5, 6), extend=True)
163+
ac.patch(ones * 6, slice=slice(6, 7), extend=True)
164+
numpy.testing.assert_equal(ac[5:6], ones * 5)
165+
numpy.testing.assert_equal(ac[6:7], ones * 6)
166+
numpy.testing.assert_equal(ac[7:8], ones * 7)
167+
152168

153169
def test_write_dataframe_full(tree):
154170
with Context.from_app(

0 commit comments

Comments
 (0)