From 8a089ceab4ba49c480012b230269099ef6d1dfd0 Mon Sep 17 00:00:00 2001 From: Anastasia Kuporosova Date: Wed, 13 Nov 2024 11:26:21 +0000 Subject: [PATCH] add test --- src/bindings/python/tests/test_graph/test_constant.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/bindings/python/tests/test_graph/test_constant.py b/src/bindings/python/tests/test_graph/test_constant.py index 0c6f98559be496..7b349ad7cd94b1 100644 --- a/src/bindings/python/tests/test_graph/test_constant.py +++ b/src/bindings/python/tests/test_graph/test_constant.py @@ -205,6 +205,14 @@ def test_init_with_scalar(init_value, src_dtype, dst_dtype, shared_flag, data_ge assert np.allclose(const_data, expected_result) +def test_cant_change_data_in_const(): + arr_0 = np.ones([1, 3, 32, 32]) + ov_const = ops.constant(arr_0) + arr_1 = np.ones([1, 3, 32, 32]) + 1 + with pytest.raises(ValueError, match="assignment destination is read-only"): + ov_const.data[:] = arr_1 + + @pytest.mark.parametrize( ("ov_type", "numpy_dtype"), [