From fad15a1617819085649ff2ed4b379749237dd0ca Mon Sep 17 00:00:00 2001 From: Christina Lee Date: Tue, 22 Oct 2024 17:24:12 -0400 Subject: [PATCH] Fix test improperly comparing measurement values (#591) * fix failing test * trying again to fix the test --- tests/test_converter.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/test_converter.py b/tests/test_converter.py index 4a0d9f88..f278939d 100644 --- a/tests/test_converter.py +++ b/tests/test_converter.py @@ -1639,6 +1639,12 @@ def test_diff_meas_circuit(self): qc.cx(0, 1) qc.measure(1, 1) + m1, m2 = load(qc)() + for m, w in zip((m1, m2), (0, 1)): + assert isinstance(m, qml.measurements.MeasurementValue) + assert len(m.measurements) == 1 + assert m.measurements[0].wires == qml.wires.Wires(w) + qc1 = QuantumCircuit(3, 3) qc1.h(0) qc1.measure(2, 2) @@ -1646,11 +1652,11 @@ def test_diff_meas_circuit(self): qc1.cx(0, 1) qc1.measure(1, 1) - qtemp, qtemp1 = load(qc), load(qc1) - assert qtemp()[0] == qml.measure(0) and qtemp1()[0] == qml.measure(2) - - qtemp2 = load(qc, measurements=[qml.expval(qml.PauliZ(0))]) - assert qtemp()[0] != qtemp2()[0] and qtemp2()[0] == qml.expval(qml.PauliZ(0)) + m1, m2 = load(qc1)() + for m, w in zip((m1, m2), (2, 1)): + assert isinstance(m, qml.measurements.MeasurementValue) + assert len(m.measurements) == 1 + assert m.measurements[0].wires == qml.wires.Wires(w) class TestConverterPennyLaneCircuitToQiskit: