From 0ddc80fc0cf1d16dbf487ba2c77634a5176ab449 Mon Sep 17 00:00:00 2001 From: andrijapau Date: Mon, 10 Feb 2025 14:39:21 -0500 Subject: [PATCH] add process state test --- tests/measurements/test_expval.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/measurements/test_expval.py b/tests/measurements/test_expval.py index ea73232e43d..c64a07e6d06 100644 --- a/tests/measurements/test_expval.py +++ b/tests/measurements/test_expval.py @@ -80,6 +80,14 @@ def test_process_density_matrix_dtype(self, coeffs, state, expected): result = mp.process_density_matrix(state, wire_order=qml.wires.Wires([0])) assert qml.math.allclose(result, expected * coeffs) + @pytest.mark.parametrize("coeffs", [1, 1j, 1 + 1j]) + def test_process_state_dtype(self, coeffs): + """Test that the return type of the process_state function is correct""" + res = qml.measurements.ExpectationMP(obs=coeffs * qml.Z(0)).process_state( + state=[1, 0], wire_order=qml.wires.Wires(0) + ) + assert np.allclose(res, coeffs) + @pytest.mark.parametrize("shots", [None, 1111, [1111, 1111]]) def test_value(self, tol, shots, seed): """Test that the expval interface works"""