def test_rigetti_qcs_aspen_device_valid_qubit( qubit: cirq.Qid, qcs_aspen8_isa: InstructionSetArchitecture ): """test RigettiQCSAspenDevice throws no error on valid qubits or operations on those qubits""" device = RigettiQCSAspenDevice(isa=qcs_aspen8_isa) device.validate_qubit(qubit) device.validate_operation(cirq.I(qubit))
def test_rigetti_qcs_aspen_device_invalid_qubit( qubit: cirq.Qid, qcs_aspen8_isa: InstructionSetArchitecture): """test RigettiQCSAspenDevice throws error on invalid qubits""" device = RigettiQCSAspenDevice(isa=qcs_aspen8_isa) with pytest.raises(UnsupportedQubit): device.validate_qubit(qubit) with pytest.raises(UnsupportedQubit): device.validate_operation(cirq.I(qubit))
def test_rigetti_qcs_aspen_device_non_existent_qubit( qcs_aspen8_isa: InstructionSetArchitecture): """test RigettiQCSAspenDevice throws error when qubit does not exist on device""" # test device may only be initialized with Aspen ISA. device_with_limited_nodes = RigettiQCSAspenDevice( isa=InstructionSetArchitecture.from_dict(qcs_aspen8_isa.to_dict())) device_with_limited_nodes.isa.architecture.nodes = [Node(node_id=10)] with pytest.raises(UnsupportedQubit): device_with_limited_nodes.validate_qubit(cirq.GridQubit(0, 0))