@@ -211,7 +211,7 @@ class TestBox(unittest.TestCase):
211211 """Tests for ``CheckedCircuit.box``."""
212212
213213 def test_boxes_the_executed_circuit (self ):
214- """Every entangling gate of the checked circuit -- check gates included -- lands in a box."""
214+ """Every entangling gate of the checked circuit lands in a box."""
215215 checked , boxed = _checked_example ()
216216 ancillas = set (checked .check_qubits )
217217 circuit_edges = [
@@ -229,12 +229,15 @@ def test_boxes_the_executed_circuit(self):
229229 # the check gates are really in there
230230 self .assertTrue (any (set (e ) & ancillas for e in boxed_edges ))
231231
232- def test_rejects_non_gate_instructions (self ):
233- """Anything but unitary gates, measures, and barriers is rejected.
232+ def test_rejects_gates_on_three_or_more_qubits (self ):
233+ """A many-qubit gate is an error: stratification would silently reorder it."""
234+ checked , _ = _checked_example ()
235+ checked .circuit .ccx (0 , 1 , 2 )
236+ with self .assertRaisesRegex (ValueError , "ccx" ):
237+ checked .box ()
234238
235- Resets alter the check propagation, and control flow can be reordered by
236- stratification, which tracks qubit wires but not clbit dataflow.
237- """
239+ def test_rejects_non_gate_instructions (self ):
240+ """Anything but unitary gates, measures, and barriers is rejected."""
238241 checked , _ = _checked_example ()
239242 checked .circuit .reset (0 )
240243 with self .assertRaisesRegex (ValueError , "reset" ):
@@ -248,15 +251,15 @@ def setUp(self):
248251 self .checked , self .isolated = _checked_example (nq = 6 , depth = 8 , seed = 4 )
249252
250253 def test_same_circuit (self ):
251- """Isolating check gates only regroups them: same gates, same unitary ."""
254+ """Isolating check gates doesn't change the unitary the circuit implements ."""
252255 stripped = self .checked ._stratify (None )
253256 self .assertEqual (_gate_counts (self .checked .circuit ), _gate_counts (stripped ))
254257 original = RemoveBarriers ()(self .checked .circuit .remove_final_measurements (inplace = False ))
255258 restratified = RemoveBarriers ()(stripped .remove_final_measurements (inplace = False ))
256259 self .assertEqual (Clifford (original ), Clifford (restratified ))
257260
258261 def test_each_check_gate_boxed_alone (self ):
259- """A check box is exactly its one gate: a single edge on a two-qubit box ."""
262+ """A check box is exactly its one gate."""
260263 ancillas = set (self .checked .check_qubits )
261264 saw_check_box = False
262265 for instruction in self .isolated .data :
@@ -270,7 +273,7 @@ def test_each_check_gate_boxed_alone(self):
270273 self .assertTrue (saw_check_box )
271274
272275 def test_unique_layers_is_payload_plus_one_per_check (self ):
273- """The whole point: two brickwork payload layers plus one unique layer per check ."""
276+ """Ensure checks add one unique layer apiece ."""
274277 ancillas = set (self .checked .check_qubits )
275278 payload , check = set (), set ()
276279 for edges in _box_edge_sets (self .isolated ):
@@ -296,19 +299,19 @@ def test_payload_layers_split_what_packing_would_merge(self):
296299 self .assertEqual (len (set (_box_edge_sets (split ))), 2 )
297300
298301 def test_rejects_foreign_payload_layers (self ):
299- """Layers that do not cover the payload's edges are an error, not a mislabelling ."""
302+ """Error on layers that do not cover the payload's edges."""
300303 with self .assertRaises (ValueError ):
301304 self .checked .box (payload_layers = _brickwork_layers (4 ))
302305
303306 def test_rejects_ambiguous_payload_layers (self ):
304- """An edge sitting in two unique layers has no well-defined boxing ."""
307+ """Error on redundant layers."""
305308 layers = _brickwork_layers (6 )
306309 layers [1 ].add ((0 , 1 ))
307310 with self .assertRaises (ValueError ):
308311 self .checked .box (payload_layers = layers )
309312
310313 def test_builds_a_samplex (self ):
311- """The isolated boxing is a working samplomatic circuit."""
314+ """The boxed circuit is a working samplomatic circuit."""
312315 samplomatic .build (self .isolated )
313316
314317
0 commit comments