Skip to content

Commit 03e5f77

Browse files
ricardoV94lucianopaz
authored andcommitted
Fix typo in __setitem__ error message
1 parent 4f7d709 commit 03e5f77

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pytensor/tensor/variable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ def is_empty_array(val):
598598

599599
def __setitem__(self, key, value):
600600
raise TypeError(
601-
"TensorVariable does not support item assignment. Use the output of `set` or `add` instead."
601+
"TensorVariable does not support item assignment. Use the output of `x[idx].set` or `x[idx].inc` instead."
602602
)
603603

604604
def take(self, indices, axis=None, mode="raise"):

tests/tensor/test_variable.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import re
12
from copy import copy
23

34
import numpy as np
@@ -444,7 +445,7 @@ def test_set_inc(self):
444445
def test_set_item_error(self):
445446
x = matrix("x")
446447

447-
msg = "Use the output of `set` or `add` instead."
448+
msg = re.escape("Use the output of `x[idx].set` or `x[idx].inc` instead.")
448449
with pytest.raises(TypeError, match=msg):
449450
x[0] = 5
450451
with pytest.raises(TypeError, match=msg):

0 commit comments

Comments
 (0)