Ejemplo n.º 1
0
def test_rigetti_qcs_aspen_device_family_validation(
        qcs_aspen8_isa: InstructionSetArchitecture):
    """test RigettiQCSAspenDevice validates architecture family on initialization"""
    non_aspen_isa = InstructionSetArchitecture.from_dict(
        qcs_aspen8_isa.to_dict())
    non_aspen_isa.architecture.family = "not-aspen"  # type: ignore
    with pytest.raises(UnsupportedRigettiQCSQuantumProcessor):
        RigettiQCSAspenDevice(isa=non_aspen_isa)
Ejemplo n.º 2
0
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))