From 22f31e2cc4de69b6139d703dd803b788b3d6db4d Mon Sep 17 00:00:00 2001 From: BChass <34097574+Bchass@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:10:29 -0400 Subject: [PATCH] test case --- tinynumpy/tests/test_tinynumpy.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tinynumpy/tests/test_tinynumpy.py b/tinynumpy/tests/test_tinynumpy.py index 49743db..c1b0480 100644 --- a/tinynumpy/tests/test_tinynumpy.py +++ b/tinynumpy/tests/test_tinynumpy.py @@ -542,6 +542,18 @@ def test_getitem(): a = np.array([[1, 2, 3, 4], [5, 6, 7, 8]]) b = tnp.array([[1, 2, 3, 4], [5, 6, 7, 8]]) +def test_setitem_writeable(): + + a = tnp.array([1, 2, 3]) + a[0] = 4 + expected_result = tnp.array([4, 2, 3, 4, 5], dtype='int64') + assert all(a == expected_result) + + with pytest.raises(ValueError): + a = tnp.array([1, 2, 3]) + a.flags = {'WRITEABLE': False} + a[0] = 4 + def test_transpose(): """test the transpose function for tinynumpy"""