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 5b64ee6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 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,15 @@ 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) as e:
ov_const.data[:] = arr_1
assert 'assignment destination is read-only' in str(e.value)


@pytest.mark.parametrize(
("ov_type", "numpy_dtype"),
[
Expand Down

0 comments on commit 5b64ee6

Please sign in to comment.