@@ -259,6 +259,30 @@ def __init__(self):
259
259
'seed, expected_circuit_length, single_qubit_layers_slice, '
260
260
'two_qubit_layers_slice' ,
261
261
(
262
+ (
263
+ (cirq .q (0 , 0 ), cirq .q (0 , 1 ), cirq .q (0 , 2 )),
264
+ 4 ,
265
+ lambda a , b , _ : cirq .CZ (a , b ),
266
+ [[(cirq .q (0 , 0 ), cirq .q (0 , 1 ))], [(cirq .q (0 , 1 ), cirq .q (0 , 2 ))]],
267
+ (cirq .X ** 0.5 ,),
268
+ True ,
269
+ 1234 ,
270
+ 9 ,
271
+ slice (None , None , 2 ),
272
+ slice (1 , None , 2 ),
273
+ ),
274
+ (
275
+ (cirq .q (0 , 0 ), cirq .q (0 , 1 ), cirq .q (0 , 2 )),
276
+ 4 ,
277
+ lambda a , b , _ : cirq .CZ (a , b ),
278
+ [[(cirq .q (0 , 1 ), cirq .q (0 , 0 ))], [(cirq .q (0 , 1 ), cirq .q (0 , 2 ))]],
279
+ (cirq .X ** 0.5 ,),
280
+ True ,
281
+ 1234 ,
282
+ 9 ,
283
+ slice (None , None , 2 ),
284
+ slice (1 , None , 2 ),
285
+ ),
262
286
(
263
287
cirq .GridQubit .rect (4 , 3 ),
264
288
20 ,
@@ -406,7 +430,10 @@ def _validate_two_qubit_layers(
406
430
# Operation is two-qubit
407
431
assert cirq .num_qubits (op ) == 2
408
432
# Operation fits pattern
409
- assert op .qubits in pattern [i % len (pattern )]
433
+ assert (
434
+ op .qubits in pattern [i % len (pattern )]
435
+ or op .qubits [::- 1 ] in pattern [i % len (pattern )]
436
+ )
410
437
active_pairs .add (op .qubits )
411
438
# All interactions that should be in this layer are present
412
439
assert all (
0 commit comments