def test_add_across_meas_map_sublists(self): """Test that implicit acquires in separate meas map sublists are all added.""" sched = add_implicit_acquires(self.sched, [[0, 2], [1, 3]]) acquired_qubits = set() for _, inst in sched.instructions: if isinstance(inst, AcquireInstruction): acquired_qubits.update({a.index for a in inst.acquires}) self.assertEqual(acquired_qubits, {0, 1, 2, 3})
def test_dont_add_all(self): """Test that acquires aren't added if no qubits in the sublist aren't being acquired.""" sched = add_implicit_acquires(self.sched, [[4, 5], [0, 2], [1, 3]]) acquired_qubits = set() for _, inst in sched.instructions: if isinstance(inst, AcquireInstruction): acquired_qubits.update({a.index for a in inst.acquires}) self.assertEqual(acquired_qubits, {0, 1, 2, 3})
def test_add_implicit(self): """Test that implicit acquires are made explicit according to the meas map.""" sched = add_implicit_acquires(self.sched, [[0, 1]]) acquired_qubits = set() for _, inst in sched.instructions: if isinstance(inst, AcquireInstruction): acquired_qubits.update({a.index for a in inst.acquires}) self.assertEqual(acquired_qubits, {0, 1})