From 4869cf1d4d677e178334b0683e7f74d4ac47e15b Mon Sep 17 00:00:00 2001 From: Ricardo Vieira Date: Tue, 3 Oct 2023 16:42:02 +0100 Subject: [PATCH] Add explicit check for failing ndarray.dot(TensorVariable) --- tests/tensor/test_variable.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/tensor/test_variable.py b/tests/tensor/test_variable.py index 3126185433..50fd625872 100644 --- a/tests/tensor/test_variable.py +++ b/tests/tensor/test_variable.py @@ -83,10 +83,12 @@ def test_dot_method(): exp_res = dot(X, y) assert equal_computations([res], [exp_res]) + # This doesn't work. Numpy calls TensorVariable.__rmul__ at some point and everything is messed up X_val = np.arange(2 * 3).reshape((2, 3)) - res = as_tensor(X_val).dot(y) + res = X_val.dot(y) exp_res = dot(X_val, y) - assert equal_computations([res], [exp_res]) + with pytest.raises(AssertionError): + assert equal_computations([res], [exp_res]) def test_infix_matmul_method():