def test_create_from_template_wrong_args(): with pytest.raises(ValueError, match='equal numbers of processor ids'): _ = factory.create_noiseless_virtual_engine_from_templates( ['sycamore', 'sycamore2'], 'weber_2021_12_10_device_spec.proto.txt' ) with pytest.raises(ValueError, match='equal numbers of processor ids'): _ = factory.create_noiseless_virtual_engine_from_proto('sycamore', [])
def test_create_from_proto(): # Create a minimal gate specification that can handle the test. device_spec = v2.device_pb2.DeviceSpecification() device_spec.valid_qubits.extend(['5_4']) gs = device_spec.valid_gate_sets.add() gs.name = 'fsim' gs.valid_gates.add().id = 'fsim' gs.valid_gates.add().id = 'xyz' gs.valid_gates.add().id = 'xy' gs.valid_gates.add().id = 'z' gs.valid_gates.add().id = 'meas' gs.valid_gates.add().id = 'wait' gs.valid_gates.add().id = 'circuit' engine = factory.create_noiseless_virtual_engine_from_proto('sycamore', device_spec) _test_processor(engine.get_processor('sycamore'))
def test_create_from_proto(): # Create a minimal gate specification that can handle the test. device_spec = text_format.Merge( """ valid_qubits: "5_4" valid_gates { phased_xz {} } valid_gates { meas {} } """, v2.device_pb2.DeviceSpecification(), ) engine = factory.create_noiseless_virtual_engine_from_proto( 'sycamore', device_spec) _test_processor(engine.get_processor('sycamore')) processor = factory.create_noiseless_virtual_processor_from_proto( 'sycamore', device_spec) _test_processor(processor)