Skip to content
12 changes: 6 additions & 6 deletions cirq-core/cirq/_compat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ def _from_deprecated_import_sub():
def _import_deprecated_first_new_second():
"""To ensure that module_a gets initialized only once.

Note that the single execution of _compat_test_data and module_a is asserted
in _test_deprecated_module_inner by counting the INFO messages emitted by
Note that the single execution of `_compat_test_data` and `module_a` is asserted
in `_test_deprecated_module_inner` by counting the INFO messages emitted by
the modules ('init:compat_test_data' and 'init:module_a').
"""

Expand All @@ -449,7 +449,7 @@ def _import_deprecated_first_new_second():
def _import_new_first_deprecated_second():
"""To ensure that module_a gets initialized only once.

It is the same as _import_deprecated_first_new_second just with different import order.
It is the same as `_import_deprecated_first_new_second` just with different import order.
See that for more details.
"""
from cirq.testing._compat_test_data.module_a import module_b
Expand Down Expand Up @@ -727,10 +727,10 @@ def test_same_name_submodule_earlier_in_subtree():
"""Tests whether module resolution works in the right order.

We have two packages with a bool `DUPE_CONSTANT` attribute each:
1. cirq.testing._compat_test_data.module_a.sub.dupe.DUPE_CONSTANT=True # the right one
2. cirq.testing._compat_test_data.module_a.dupe.DUPE_CONSTANT=False # the wrong one
1. `cirq.testing._compat_test_data.module_a.sub.dupe.DUPE_CONSTANT=True` # the right one
2. `cirq.testing._compat_test_data.module_a.dupe.DUPE_CONSTANT=False` # the wrong one

If the new module's (in this case cirq.testing._compat_test_data.module_a) path has precedence
If the new module's (in this case `cirq.testing._compat_test_data.module_a`) path has precedence
during module spec resolution, dupe number 2 is going to get resolved.

You might wonder where this comes up in cirq. There was a bug where the lookup path was not in
Expand Down
4 changes: 2 additions & 2 deletions cirq-core/cirq/circuits/circuit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2620,7 +2620,7 @@ def test_circuit_superoperator_too_many_qubits() -> None:
),
)
def test_circuit_superoperator_fixed_values(circuit, expected_superoperator) -> None:
"""Tests Circuit._superoperator_() on a few simple circuits."""
"""Tests `Circuit._superoperator_()` on a few simple circuits."""
assert circuit._has_superoperator_()
assert np.allclose(circuit._superoperator_(), expected_superoperator)

Expand All @@ -2638,7 +2638,7 @@ def test_circuit_superoperator_fixed_values(circuit, expected_superoperator) ->
),
)
def test_circuit_superoperator_depolarizing_channel_compositions(rs, n_qubits) -> None:
"""Tests Circuit._superoperator_() on compositions of depolarizing channels."""
"""Tests `Circuit._superoperator_()` on compositions of depolarizing channels."""

def pauli_error_probability(r: float, n_qubits: int) -> float:
"""Computes Pauli error probability for given depolarization parameter.
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/contrib/ghz/ghz_2d_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_ghz_circuits_state(


def test_transform_circuit_properties() -> None:
"""Tests that _transform_circuit preserves circuit properties."""
"""Tests that `_transform_circuit` preserves circuit properties."""
circuit = ghz_2d.generate_2d_ghz_circuit(
CENTER_QUBIT, GRAPH, num_qubits=9, randomized=False, add_dd_and_align_right=False
)
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/devices/grid_qubit.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def is_adjacent(self, other: cirq.Qid) -> bool:
def neighbors(self, qids: Iterable[ops.Qid] | None = None) -> set[_BaseGridQid]:
"""Returns qubits that are potential neighbors to this GridQid.

Note that this returns _potential_ neighbors. That is, if no arguments
Note that this returns *potential* neighbors. That is, if no arguments
are given, this returns the qubits above, below, to the right and left of
the Qid in the grid. It does not take into account any hardware device
layout.
Expand Down
4 changes: 2 additions & 2 deletions cirq-core/cirq/ops/common_gates_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,14 +432,14 @@ def test_x_act_on_tableau() -> None:


class iZGate(cirq.testing.SingleQubitGate):
"""Equivalent to an iZ gate without _act_on_ defined on it."""
"""Equivalent to an iZ gate without `_act_on_` defined on it."""

def _unitary_(self):
return np.array([[1j, 0], [0, -1j]])


class MinusOnePhaseGate(cirq.testing.SingleQubitGate):
"""Equivalent to a -1 global phase without _act_on_ defined on it."""
"""Equivalent to a -1 global phase without `_act_on_` defined on it."""

def _unitary_(self):
return np.array([[-1, 0], [0, -1]])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_approx_eq_special_numerics() -> None:


class X(Number):
"""Subtype of Number that can fallback to __eq__"""
"""Subtype of Number that can fallback to `__eq__`"""

def __init__(self, val):
self.val = val
Expand All @@ -128,7 +128,7 @@ def __hash__(self):


class Y(Number):
"""Subtype of Number that cannot fallback to __eq__"""
"""Subtype of Number that cannot fallback to `__eq__`"""

def __init__(self):
pass
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/protocols/hash_from_pickle_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def _read_json(json_filename: str) -> Any:


def test_exclude_json_files_has_valid_entries() -> None:
"""Verify _EXCLUDE_JSON_FILES has valid entries."""
"""Verify `_EXCLUDE_JSON_FILES` has valid entries."""
json_file_validates = lambda f: any(
m.test_data_path.joinpath(os.path.basename(f)).is_file() for m in MODULE_TEST_SPECS
)
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/protocols/kraus_protocol_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def _apply_channel_(self, args):
],
)
def test_kraus_fallback_to_apply_channel(channel_cls, params) -> None:
"""Kraus protocol falls back to _apply_channel_ when no _kraus_, _mixture_, or _unitary_."""
"""Falls back to `_apply_channel_` without `_kraus_`, `_mixture_`, or `_unitary_`."""
# Create the expected channel and get its Kraus operators
expected_channel = channel_cls(*params)
expected_kraus = cirq.kraus(expected_channel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def test_unrecognized_diagonal_breaks_chain():


def test_is_z_or_cz_pow_gate_helper_edge_cases():
"""Test edge cases in _is_z_or_cz_pow_gate helper function for full coverage."""
"""Test edge cases in `_is_z_or_cz_pow_gate` helper function for full coverage."""

q = cirq.NamedQubit('q')

Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/transformers/dynamical_decoupling_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ def test_labeled_circuit_str():


def test_labeled_circuit_str_empty():
"""Tests the __str__ method of _Grid for empty and no-qubit circuits."""
"""Tests the `__str__` method of `_Grid` for empty and no-qubit circuits."""
# Test case for an empty circuit (no moments, no qubits)
empty_circuit = cirq.Circuit()
labeled_empty = _Grid.from_circuit(empty_circuit, single_qubit_gate_moments_only=True)
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/value/abc_alt_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def alt(self):

def test_classcell_in_namespace():
"""Tests a historical issue where super() triggers Python to add
`__classcell__` to the namespace passed to the metaclass __new__.
`__classcell__` to the namespace passed to the metaclass `__new__`.
"""

# Test that the class is created without wrongly raising a TypeError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_rng_state_is_restored():


def test_equality():
"""Tests the __eq__ method for comparing sweep instances."""
"""Tests the `__eq__` method for comparing sweep instances."""
sweep1 = cirq_google.study.FiniteRandomVariable(
key=KEY, distribution=DIST, seed=SEED, length=LENGTH
)
Expand Down
Loading
Loading