Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
eliottrosenberg committed Mar 3, 2025
1 parent f922795 commit 44e8ccd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cirq-core/cirq/transformers/gauge_compiling/cphase_gauge.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _get_new_post(self, exponent: float, pre: ops.Gate) -> ops.Gate:
elif pre == ops.Y:
return ops.PhasedXZGate.from_zyz_exponents(z0=-exponent, y=1, z1=0)
else:
raise ValueError("pre should be cirq.X or cirq.Y")
raise ValueError("pre should be cirq.X or cirq.Y") # pragma: no cover

def _get_constant_gauge(
self, gate: ops.CZPowGate, pre_q0: ops.Gate, pre_q1: ops.Gate
Expand Down Expand Up @@ -111,7 +111,7 @@ def _get_constant_gauge(
post_q1=self._get_new_post(exponent, pre_q1),
)
else:
raise ValueError("pre_q0 and pre_q1 should be single-qubit Pauli operators")
raise ValueError("pre_q0 and pre_q1 should be X, Y, Z, or I") # pragma: no cover

def sample(self, gate: ops.Gate, prng: np.random.Generator) -> ConstantGauge:
"""Sample the 16 cphase gauges at random.
Expand All @@ -128,7 +128,7 @@ def sample(self, gate: ops.Gate, prng: np.random.Generator) -> ConstantGauge:
"""

if not type(gate) == ops.CZPowGate:
raise TypeError("gate must be a CZPowGate")
raise TypeError("gate must be a CZPowGate") # pragma: no cover
pre_q0, pre_q1 = prng.choice(np.array([ops.I, ops.X, ops.Y, ops.Z]), size=2, replace=True)
return self._get_constant_gauge(gate, pre_q0, pre_q1)

Expand Down

0 comments on commit 44e8ccd

Please sign in to comment.