@@ -204,6 +204,24 @@ def _create_device_spec_with_all_couplings():
204
204
return spec
205
205
206
206
207
+ def _create_device_spec_with_isolated_qubits ():
208
+ # Qubit layout:
209
+ # x -- x
210
+ # x -- x
211
+ # x -- x
212
+ # x -- x
213
+ # x -- x
214
+ # x x
215
+ device_info , spec = _create_device_spec_with_horizontal_couplings ()
216
+
217
+ isolated_qubits = [cirq .GridQubit (GRID_HEIGHT , j ) for j in range (2 )]
218
+ spec .valid_qubits .extend ([v2 .qubit_to_proto_id (q ) for q in isolated_qubits ])
219
+
220
+ device_info .grid_qubits .extend (isolated_qubits )
221
+
222
+ return device_info , spec
223
+
224
+
207
225
def _create_device_spec_duplicate_qubit () -> v2 .device_pb2 .DeviceSpecification :
208
226
"""Creates a DeviceSpecification with a qubit name that does not conform to '<int>_<int>'."""
209
227
q_proto_id = v2 .qubit_to_proto_id (cirq .GridQubit (0 , 0 ))
@@ -440,7 +458,7 @@ def test_grid_device_repr_pretty(cycle, func):
440
458
441
459
442
460
def test_device_from_device_information_equals_device_from_proto ():
443
- device_info , spec = _create_device_spec_with_horizontal_couplings ()
461
+ device_info , spec = _create_device_spec_with_isolated_qubits ()
444
462
445
463
# The set of gates in gateset and gate durations are consistent with what's generated in
446
464
# _create_device_spec_with_horizontal_couplings()
@@ -482,7 +500,10 @@ def test_device_from_device_information_equals_device_from_proto():
482
500
}
483
501
484
502
device_from_information = cirq_google .GridDevice ._from_device_information (
485
- qubit_pairs = device_info .qubit_pairs , gateset = gateset , gate_durations = gate_durations
503
+ qubit_pairs = device_info .qubit_pairs ,
504
+ gateset = gateset ,
505
+ gate_durations = gate_durations ,
506
+ all_qubits = device_info .grid_qubits ,
486
507
)
487
508
488
509
assert device_from_information == cirq_google .GridDevice .from_proto (spec )
0 commit comments