Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
akuporos committed Nov 13, 2024
1 parent ad146ba commit 8a089ce
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/bindings/python/tests/test_graph/test_constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
[
Expand Down

0 comments on commit 8a089ce

Please sign in to comment.