Skip to content

Commit cabb593

Browse files
Deprecate and raise AttributeError for MaxAndArgmax
1 parent 25af747 commit cabb593

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pytensor/tensor/math.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@
110110
def __getattr__(name):
111111
if name == "MaxAndArgmax":
112112
raise AttributeError(
113-
"The class `MaxAndArgmax` has been deprecated. "
114-
"Call `Max` and `Argmax` separately as an alternative."
113+
"The class `MaxandArgmax` has been deprecated. Call `Max` and `Argmax` seperately as an alternative."
115114
)
115+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
116116

117117

118118
def _get_atol_rtol(a, b):

tests/tensor/test_math.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,10 @@ def test_bool(self):
14231423

14241424

14251425
def test_MaxAndArgmax_deprecated():
1426-
with pytest.raises(AttributeError):
1426+
with pytest.raises(
1427+
AttributeError,
1428+
match="The class `MaxandArgmax` has been deprecated. Call `Max` and `Argmax` seperately as an alternative.",
1429+
):
14271430
pytensor.tensor.math.MaxAndArgmax
14281431

14291432

0 commit comments

Comments
 (0)