diff --git a/tests/ops/op_math/test_adjoint_op.py b/tests/ops/op_math/test_adjoint_op.py index 4c2bfe22a3c..b381ea72315 100644 --- a/tests/ops/op_math/test_adjoint_op.py +++ b/tests/ops/op_math/test_adjoint_op.py @@ -502,6 +502,15 @@ def test_do_queue_False(self): class TestMatrix: """Test the matrix method for a variety of interfaces.""" + def test_batching_error(self): + """Test that a MatrixUndefinedError is raised if the base is batched.""" + x = qml.numpy.array([0.1, 0.2, 0.3]) + base = qml.RX(x, wires=0) + op = Adjoint(base) + + with pytest.raises(qml.operation.MatrixUndefinedError): + op.matrix() + def check_matrix(self, x, interface): """Compares matrices in a interface independent manner.""" base = qml.RX(x, wires=0)