cirq-core 1.6.0.dev20250509215532__py3-none-any.whl → 1.6.0.dev20250512192405__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cirq-core might be problematic. Click here for more details.

Files changed (167) hide show
  1. cirq/_version.py +1 -1
  2. cirq/_version_test.py +2 -2
  3. cirq/circuits/_block_diagram_drawer_test.py +6 -6
  4. cirq/circuits/_box_drawing_character_data_test.py +1 -1
  5. cirq/circuits/insert_strategy_test.py +2 -2
  6. cirq/circuits/optimization_pass_test.py +5 -5
  7. cirq/contrib/acquaintance/inspection_utils_test.py +2 -2
  8. cirq/contrib/acquaintance/mutation_utils_test.py +2 -2
  9. cirq/contrib/acquaintance/optimizers_test.py +1 -1
  10. cirq/contrib/acquaintance/shift_test.py +6 -6
  11. cirq/contrib/acquaintance/strategies/cubic_test.py +2 -2
  12. cirq/contrib/acquaintance/topological_sort_test.py +1 -1
  13. cirq/contrib/hacks/disable_validation_test.py +1 -1
  14. cirq/contrib/json_test.py +3 -3
  15. cirq/contrib/noise_models/noise_models_test.py +8 -8
  16. cirq/contrib/paulistring/clifford_optimize_test.py +5 -5
  17. cirq/contrib/paulistring/clifford_target_gateset_test.py +11 -11
  18. cirq/contrib/paulistring/optimize_test.py +3 -3
  19. cirq/contrib/paulistring/pauli_string_dag_test.py +1 -1
  20. cirq/contrib/paulistring/pauli_string_optimize_test.py +3 -3
  21. cirq/contrib/paulistring/recombine_test.py +1 -1
  22. cirq/contrib/paulistring/separate_test.py +1 -1
  23. cirq/contrib/qasm_import/_parser_test.py +67 -67
  24. cirq/contrib/qcircuit/qcircuit_pdf_test.py +1 -1
  25. cirq/contrib/qcircuit/qcircuit_test.py +6 -6
  26. cirq/contrib/routing/greedy_test.py +2 -2
  27. cirq/contrib/routing/initialization_test.py +3 -3
  28. cirq/contrib/svg/svg_test.py +5 -5
  29. cirq/devices/device_test.py +4 -4
  30. cirq/devices/insertion_noise_model_test.py +5 -5
  31. cirq/devices/named_topologies_test.py +10 -10
  32. cirq/devices/noise_properties_test.py +1 -1
  33. cirq/experiments/n_qubit_tomography_test.py +5 -5
  34. cirq/experiments/t1_decay_experiment_test.py +11 -11
  35. cirq/interop/quirk/cells/arithmetic_cells_test.py +14 -14
  36. cirq/interop/quirk/cells/control_cells_test.py +5 -5
  37. cirq/interop/quirk/cells/frequency_space_cells_test.py +1 -1
  38. cirq/interop/quirk/cells/ignored_cells_test.py +1 -1
  39. cirq/interop/quirk/cells/input_cells_test.py +5 -5
  40. cirq/interop/quirk/cells/input_rotation_cells_test.py +7 -7
  41. cirq/interop/quirk/cells/measurement_cells_test.py +1 -1
  42. cirq/interop/quirk/cells/qubit_permutation_cells_test.py +7 -7
  43. cirq/interop/quirk/cells/scalar_cells_test.py +1 -1
  44. cirq/interop/quirk/cells/single_qubit_rotation_cells_test.py +3 -3
  45. cirq/interop/quirk/cells/swap_cell_test.py +4 -4
  46. cirq/interop/quirk/cells/testing_test.py +6 -6
  47. cirq/interop/quirk/cells/unsupported_cells_test.py +2 -2
  48. cirq/linalg/combinators_test.py +7 -7
  49. cirq/linalg/diagonalize_test.py +10 -10
  50. cirq/linalg/operator_spaces_test.py +11 -11
  51. cirq/linalg/tolerance_test.py +4 -4
  52. cirq/neutral_atoms/convert_to_neutral_atom_gates_test.py +1 -1
  53. cirq/ops/arithmetic_operation_test.py +2 -2
  54. cirq/ops/common_channels_test.py +80 -80
  55. cirq/ops/fsim_gate_test.py +26 -26
  56. cirq/ops/gate_features_test.py +3 -3
  57. cirq/ops/greedy_qubit_manager_test.py +3 -3
  58. cirq/ops/mixed_unitary_channel_test.py +11 -11
  59. cirq/ops/parallel_gate_test.py +16 -16
  60. cirq/ops/parity_gates_test.py +34 -32
  61. cirq/ops/pauli_gates_test.py +20 -20
  62. cirq/ops/pauli_interaction_gate_test.py +8 -8
  63. cirq/ops/pauli_sum_exponential_test.py +10 -10
  64. cirq/ops/permutation_gate_test.py +8 -8
  65. cirq/ops/phased_iswap_gate_test.py +15 -15
  66. cirq/ops/qubit_manager_test.py +4 -4
  67. cirq/ops/random_gate_channel_test.py +11 -11
  68. cirq/ops/state_preparation_channel_test.py +8 -8
  69. cirq/ops/swap_gates_test.py +17 -17
  70. cirq/ops/tags_test.py +2 -2
  71. cirq/ops/three_qubit_gates_test.py +17 -17
  72. cirq/ops/two_qubit_diagonal_gate_test.py +8 -8
  73. cirq/ops/uniform_superposition_gate_test.py +3 -3
  74. cirq/protocols/act_on_protocol_test.py +6 -6
  75. cirq/protocols/circuit_diagram_info_protocol_test.py +13 -13
  76. cirq/protocols/control_key_protocol_test.py +1 -1
  77. cirq/protocols/decompose_protocol_test.py +12 -12
  78. cirq/protocols/equal_up_to_global_phase_protocol_test.py +6 -6
  79. cirq/protocols/has_stabilizer_effect_protocol_test.py +5 -5
  80. cirq/protocols/has_unitary_protocol_test.py +8 -8
  81. cirq/protocols/hash_from_pickle_test.py +1 -1
  82. cirq/protocols/inverse_protocol_test.py +2 -2
  83. cirq/protocols/kraus_protocol_test.py +9 -9
  84. cirq/protocols/measurement_key_protocol_test.py +10 -10
  85. cirq/protocols/pauli_expansion_protocol_test.py +2 -2
  86. cirq/protocols/phase_protocol_test.py +1 -1
  87. cirq/protocols/qasm_test.py +3 -3
  88. cirq/protocols/qid_shape_protocol_test.py +1 -1
  89. cirq/protocols/resolve_parameters_test.py +5 -5
  90. cirq/protocols/trace_distance_bound_test.py +1 -1
  91. cirq/qis/channels_test.py +16 -16
  92. cirq/qis/measures_test.py +16 -14
  93. cirq/qis/noise_utils_test.py +7 -7
  94. cirq/sim/clifford/clifford_tableau_simulation_state_test.py +3 -3
  95. cirq/sim/clifford/stabilizer_ch_form_simulation_state_test.py +6 -6
  96. cirq/sim/clifford/stabilizer_sampler_test.py +2 -2
  97. cirq/sim/clifford/stabilizer_simulation_state_test.py +4 -4
  98. cirq/sim/clifford/stabilizer_state_ch_form_test.py +2 -2
  99. cirq/sim/density_matrix_simulation_state_test.py +8 -8
  100. cirq/sim/density_matrix_utils_test.py +36 -36
  101. cirq/sim/simulation_product_state_test.py +22 -22
  102. cirq/sim/simulation_state_test.py +12 -12
  103. cirq/sim/simulation_utils_test.py +1 -1
  104. cirq/sim/state_vector_simulation_state_test.py +12 -12
  105. cirq/study/flatten_expressions_test.py +11 -11
  106. cirq/study/resolver_test.py +20 -20
  107. cirq/testing/consistent_act_on_test.py +1 -1
  108. cirq/testing/consistent_channels_test.py +8 -8
  109. cirq/testing/consistent_controlled_gate_op_test.py +2 -2
  110. cirq/testing/consistent_decomposition_test.py +2 -2
  111. cirq/testing/consistent_pauli_expansion_test.py +1 -1
  112. cirq/testing/consistent_phase_by_test.py +1 -1
  113. cirq/testing/consistent_qasm_test.py +1 -1
  114. cirq/testing/consistent_specified_has_unitary_test.py +4 -4
  115. cirq/testing/consistent_unitary_test.py +2 -2
  116. cirq/testing/deprecation_test.py +2 -2
  117. cirq/testing/devices_test.py +4 -4
  118. cirq/testing/equivalent_basis_map_test.py +2 -2
  119. cirq/testing/equivalent_repr_eval_test.py +3 -3
  120. cirq/testing/gate_features_test.py +5 -5
  121. cirq/testing/json_test.py +3 -3
  122. cirq/testing/lin_alg_utils_test.py +12 -12
  123. cirq/testing/logs_test.py +7 -7
  124. cirq/testing/no_identifier_qubit_test.py +3 -3
  125. cirq/testing/op_tree_test.py +1 -1
  126. cirq/testing/order_tester_test.py +6 -6
  127. cirq/testing/pytest_utils_test.py +2 -2
  128. cirq/testing/random_circuit_test.py +5 -5
  129. cirq/testing/repr_pretty_tester_test.py +3 -3
  130. cirq/testing/routing_devices_test.py +6 -6
  131. cirq/testing/sample_circuits_test.py +1 -1
  132. cirq/testing/sample_gates_test.py +2 -2
  133. cirq/transformers/analytical_decompositions/pauli_string_decomposition_test.py +3 -3
  134. cirq/transformers/analytical_decompositions/three_qubit_decomposition_test.py +7 -7
  135. cirq/transformers/analytical_decompositions/two_qubit_to_cz_test.py +6 -6
  136. cirq/transformers/analytical_decompositions/two_qubit_to_fsim_test.py +5 -5
  137. cirq/transformers/analytical_decompositions/two_qubit_to_ms_test.py +1 -1
  138. cirq/transformers/drop_empty_moments_test.py +2 -2
  139. cirq/transformers/eject_phased_paulis_test.py +9 -9
  140. cirq/transformers/heuristic_decompositions/two_qubit_gate_tabulation_test.py +7 -7
  141. cirq/transformers/insertion_sort_test.py +1 -1
  142. cirq/transformers/merge_k_qubit_gates_test.py +9 -9
  143. cirq/transformers/qubit_management_transformers_test.py +3 -3
  144. cirq/transformers/randomized_measurements_test.py +8 -4
  145. cirq/transformers/routing/line_initial_mapper_test.py +5 -5
  146. cirq/transformers/routing/route_circuit_cqc_test.py +13 -13
  147. cirq/transformers/routing/visualize_routed_circuit_test.py +2 -2
  148. cirq/transformers/synchronize_terminal_measurements_test.py +10 -10
  149. cirq/transformers/target_gatesets/compilation_target_gateset_test.py +8 -8
  150. cirq/transformers/target_gatesets/cz_gateset_test.py +17 -17
  151. cirq/transformers/target_gatesets/sqrt_iswap_gateset_test.py +23 -23
  152. cirq/value/angle_test.py +3 -3
  153. cirq/value/classical_data_test.py +8 -8
  154. cirq/value/periodic_value_test.py +9 -7
  155. cirq/value/probability_test.py +2 -2
  156. cirq/value/value_equality_attr_test.py +11 -11
  157. cirq/vis/histogram_test.py +2 -2
  158. cirq/vis/state_histogram_test.py +5 -5
  159. cirq/vis/vis_utils_test.py +1 -1
  160. cirq/work/observable_grouping_test.py +8 -8
  161. cirq/work/observable_readout_calibration_test.py +1 -1
  162. cirq/work/zeros_sampler_test.py +4 -4
  163. {cirq_core-1.6.0.dev20250509215532.dist-info → cirq_core-1.6.0.dev20250512192405.dist-info}/METADATA +1 -1
  164. {cirq_core-1.6.0.dev20250509215532.dist-info → cirq_core-1.6.0.dev20250512192405.dist-info}/RECORD +167 -167
  165. {cirq_core-1.6.0.dev20250509215532.dist-info → cirq_core-1.6.0.dev20250512192405.dist-info}/WHEEL +0 -0
  166. {cirq_core-1.6.0.dev20250509215532.dist-info → cirq_core-1.6.0.dev20250512192405.dist-info}/licenses/LICENSE +0 -0
  167. {cirq_core-1.6.0.dev20250509215532.dist-info → cirq_core-1.6.0.dev20250512192405.dist-info}/top_level.txt +0 -0
@@ -7,7 +7,7 @@ import cirq
7
7
  from cirq.contrib.svg import circuit_to_svg, SVGCircuit
8
8
 
9
9
 
10
- def test_svg():
10
+ def test_svg() -> None:
11
11
  a, b, c = cirq.LineQubit.range(3)
12
12
 
13
13
  svg_text = circuit_to_svg(
@@ -26,7 +26,7 @@ def test_svg():
26
26
  assert '</svg>' in svg_text
27
27
 
28
28
 
29
- def test_svg_noise():
29
+ def test_svg_noise() -> None:
30
30
  noise_model = cirq.ConstantQubitNoiseModel(cirq.DepolarizingChannel(p=1e-3))
31
31
  q = cirq.LineQubit(0)
32
32
  circuit = cirq.Circuit(cirq.X(q))
@@ -35,12 +35,12 @@ def test_svg_noise():
35
35
  assert '>D(0.001)</text>' in svg
36
36
 
37
37
 
38
- def test_validation():
38
+ def test_validation() -> None:
39
39
  with pytest.raises(ValueError):
40
40
  circuit_to_svg(cirq.Circuit())
41
41
 
42
42
 
43
- def test_empty_moments():
43
+ def test_empty_moments() -> None:
44
44
  a, b = cirq.LineQubit.range(2)
45
45
  svg_1 = circuit_to_svg(
46
46
  cirq.Circuit(
@@ -73,7 +73,7 @@ def test_empty_moments():
73
73
  ('A[<virtual>]B[cirq.VirtualTag()]C>D<E', 'ABC&gt;D&lt;E'),
74
74
  ],
75
75
  )
76
- def test_gate_with_less_greater_str(symbol, svg_symbol):
76
+ def test_gate_with_less_greater_str(symbol, svg_symbol) -> None:
77
77
  class CustomGate(cirq.Gate):
78
78
  def _num_qubits_(self) -> int:
79
79
  return 1
@@ -4,14 +4,14 @@ import networkx as nx
4
4
  import cirq
5
5
 
6
6
 
7
- def test_device_metadata():
7
+ def test_device_metadata() -> None:
8
8
  class RawDevice(cirq.Device):
9
9
  pass
10
10
 
11
11
  assert RawDevice().metadata is None
12
12
 
13
13
 
14
- def test_metadata():
14
+ def test_metadata() -> None:
15
15
  qubits = cirq.LineQubit.range(4)
16
16
  graph = nx.star_graph(3)
17
17
  metadata = cirq.DeviceMetadata(qubits, graph)
@@ -19,7 +19,7 @@ def test_metadata():
19
19
  assert metadata.nx_graph == graph
20
20
 
21
21
 
22
- def test_metadata_json_load_logic():
22
+ def test_metadata_json_load_logic() -> None:
23
23
  qubits = cirq.LineQubit.range(4)
24
24
  graph = nx.star_graph(3)
25
25
  metadata = cirq.DeviceMetadata(qubits, graph)
@@ -27,7 +27,7 @@ def test_metadata_json_load_logic():
27
27
  assert metadata == cirq.read_json(json_text=str_rep)
28
28
 
29
29
 
30
- def test_metadata_equality():
30
+ def test_metadata_equality() -> None:
31
31
  qubits = cirq.LineQubit.range(4)
32
32
  graph = nx.star_graph(3)
33
33
  graph2 = nx.star_graph(3)
@@ -17,7 +17,7 @@ from cirq.devices.insertion_noise_model import InsertionNoiseModel
17
17
  from cirq.devices.noise_utils import OpIdentifier, PHYSICAL_GATE_TAG
18
18
 
19
19
 
20
- def test_insertion_noise():
20
+ def test_insertion_noise() -> None:
21
21
  q0, q1 = cirq.LineQubit.range(2)
22
22
  op_id0 = OpIdentifier(cirq.XPowGate, q0)
23
23
  op_id1 = OpIdentifier(cirq.ZPowGate, q1)
@@ -50,7 +50,7 @@ def test_insertion_noise():
50
50
  cirq.testing.assert_equivalent_repr(model)
51
51
 
52
52
 
53
- def test_colliding_noise_qubits():
53
+ def test_colliding_noise_qubits() -> None:
54
54
  # Check that noise affecting other qubits doesn't cause issues.
55
55
  q0, q1, q2, q3 = cirq.LineQubit.range(4)
56
56
  op_id0 = OpIdentifier(cirq.CZPowGate)
@@ -66,7 +66,7 @@ def test_colliding_noise_qubits():
66
66
  cirq.testing.assert_equivalent_repr(model)
67
67
 
68
68
 
69
- def test_prepend():
69
+ def test_prepend() -> None:
70
70
  q0, q1 = cirq.LineQubit.range(2)
71
71
  op_id0 = OpIdentifier(cirq.XPowGate, q0)
72
72
  op_id1 = OpIdentifier(cirq.ZPowGate, q1)
@@ -81,7 +81,7 @@ def test_prepend():
81
81
  ]
82
82
 
83
83
 
84
- def test_require_physical_tag():
84
+ def test_require_physical_tag() -> None:
85
85
  q0, q1 = cirq.LineQubit.range(2)
86
86
  op_id0 = OpIdentifier(cirq.XPowGate, q0)
87
87
  op_id1 = OpIdentifier(cirq.ZPowGate, q1)
@@ -95,7 +95,7 @@ def test_require_physical_tag():
95
95
  ]
96
96
 
97
97
 
98
- def test_supertype_matching():
98
+ def test_supertype_matching() -> None:
99
99
  # Demonstrate that the model applies the closest matching type
100
100
  # if multiple types match a given gate.
101
101
  q0 = cirq.LineQubit(0)
@@ -29,7 +29,7 @@ from cirq import (
29
29
 
30
30
 
31
31
  @pytest.mark.parametrize('width, height', list(itertools.product([1, 2, 3, 24], repeat=2)))
32
- def test_tilted_square_lattice(width, height):
32
+ def test_tilted_square_lattice(width, height) -> None:
33
33
  topo = TiltedSquareLattice(width, height)
34
34
  assert topo.graph.number_of_edges() == width * height
35
35
  assert all(1 <= topo.graph.degree[node] <= 4 for node in topo.graph.nodes)
@@ -41,14 +41,14 @@ def test_tilted_square_lattice(width, height):
41
41
  cirq.testing.assert_equivalent_repr(topo)
42
42
 
43
43
 
44
- def test_bad_tilted_square_lattice():
44
+ def test_bad_tilted_square_lattice() -> None:
45
45
  with pytest.raises(ValueError):
46
46
  _ = TiltedSquareLattice(0, 3)
47
47
  with pytest.raises(ValueError):
48
48
  _ = TiltedSquareLattice(3, 0)
49
49
 
50
50
 
51
- def test_tilted_square_methods():
51
+ def test_tilted_square_methods() -> None:
52
52
  topo = TiltedSquareLattice(5, 5)
53
53
  ax = MagicMock()
54
54
  topo.draw(ax=ax)
@@ -63,13 +63,13 @@ def test_tilted_square_methods():
63
63
  )
64
64
 
65
65
 
66
- def test_tilted_square_lattice_n_nodes():
66
+ def test_tilted_square_lattice_n_nodes() -> None:
67
67
  for width, height in itertools.product(list(range(1, 4 + 1)), repeat=2):
68
68
  topo = TiltedSquareLattice(width, height)
69
69
  assert topo.n_nodes == topo.graph.number_of_nodes()
70
70
 
71
71
 
72
- def test_line_topology():
72
+ def test_line_topology() -> None:
73
73
  n = 10
74
74
  topo = LineTopology(n)
75
75
  assert topo.n_nodes == n
@@ -94,13 +94,13 @@ def test_line_topology():
94
94
  cirq.testing.assert_equivalent_repr(topo)
95
95
 
96
96
 
97
- def test_line_topology_nodes_as_qubits():
97
+ def test_line_topology_nodes_as_qubits() -> None:
98
98
  for n in range(2, 10, 2):
99
99
  assert LineTopology(n).nodes_as_linequbits() == cirq.LineQubit.range(n)
100
100
 
101
101
 
102
102
  @pytest.mark.parametrize('tilted', [True, False])
103
- def test_draw_gridlike(tilted):
103
+ def test_draw_gridlike(tilted) -> None:
104
104
  graph = nx.grid_2d_graph(3, 3)
105
105
  ax = MagicMock()
106
106
  pos = draw_gridlike(graph, tilted=tilted, ax=ax)
@@ -111,7 +111,7 @@ def test_draw_gridlike(tilted):
111
111
 
112
112
 
113
113
  @pytest.mark.parametrize('tilted', [True, False])
114
- def test_draw_gridlike_qubits(tilted):
114
+ def test_draw_gridlike_qubits(tilted) -> None:
115
115
  graph = nx.grid_2d_graph(3, 3)
116
116
  graph = nx.relabel_nodes(graph, {(r, c): cirq.GridQubit(r, c) for r, c in sorted(graph.nodes)})
117
117
  ax = MagicMock()
@@ -122,7 +122,7 @@ def test_draw_gridlike_qubits(tilted):
122
122
  assert 0 <= q.col < 3
123
123
 
124
124
 
125
- def test_get_placements():
125
+ def test_get_placements() -> None:
126
126
  topo = TiltedSquareLattice(4, 2)
127
127
  syc23 = TiltedSquareLattice(8, 4).graph
128
128
  placements = get_placements(syc23, topo.graph)
@@ -134,7 +134,7 @@ def test_get_placements():
134
134
  ax.scatter.assert_called()
135
135
 
136
136
 
137
- def test_is_valid_placement():
137
+ def test_is_valid_placement() -> None:
138
138
  topo = TiltedSquareLattice(4, 2)
139
139
  syc23 = TiltedSquareLattice(8, 4).graph
140
140
  placements = get_placements(syc23, topo.graph)
@@ -35,7 +35,7 @@ class SampleNoiseProperties(NoiseProperties):
35
35
  return [add_h, add_iswap]
36
36
 
37
37
 
38
- def test_sample_model():
38
+ def test_sample_model() -> None:
39
39
  q0, q1 = cirq.LineQubit.range(2)
40
40
  props = SampleNoiseProperties([q0, q1], [(q0, q1), (q1, q0)])
41
41
  model = NoiseModelFromNoiseProperties(props)
@@ -21,7 +21,7 @@ import cirq
21
21
  Q0, Q1, Q2, Q3 = cirq.LineQubit.range(4)
22
22
 
23
23
 
24
- def test_state_tomography_diagonal():
24
+ def test_state_tomography_diagonal() -> None:
25
25
  n = 2
26
26
  qubits = cirq.LineQubit.range(n)
27
27
  for state in range(2**n):
@@ -42,7 +42,7 @@ def test_state_tomography_diagonal():
42
42
  assert np.allclose(res.data, should_be, atol=0.05)
43
43
 
44
44
 
45
- def test_state_tomography_ghz_state():
45
+ def test_state_tomography_ghz_state() -> None:
46
46
  circuit = cirq.Circuit()
47
47
  circuit.append(cirq.H(cirq.LineQubit(0)))
48
48
  circuit.append(cirq.CNOT(cirq.LineQubit(0), cirq.LineQubit(1)))
@@ -61,7 +61,7 @@ def test_state_tomography_ghz_state():
61
61
  assert np.allclose(res.data, should_be, atol=0.05)
62
62
 
63
63
 
64
- def test_make_experiment_no_rots():
64
+ def test_make_experiment_no_rots() -> None:
65
65
  exp = cirq.experiments.StateTomographyExperiment(
66
66
  [cirq.LineQubit(0), cirq.LineQubit(1), cirq.LineQubit(2)]
67
67
  )
@@ -97,7 +97,7 @@ def compute_density_matrix(circuit: cirq.Circuit, qubits: Sequence[cirq.Qid]) ->
97
97
  ),
98
98
  ),
99
99
  )
100
- def test_density_matrix_from_state_tomography_is_correct(circuit, qubits):
100
+ def test_density_matrix_from_state_tomography_is_correct(circuit, qubits) -> None:
101
101
  sim = cirq.Simulator(seed=87539319)
102
102
  tomography_result = cirq.experiments.state_tomography(sim, qubits, circuit, repetitions=5000)
103
103
  actual_rho = tomography_result.data
@@ -115,7 +115,7 @@ def test_density_matrix_from_state_tomography_is_correct(circuit, qubits):
115
115
  cirq.Circuit(cirq.X(Q0) ** 0.25, cirq.ISWAP(Q0, Q1)),
116
116
  ),
117
117
  )
118
- def test_agrees_with_two_qubit_state_tomography(circuit):
118
+ def test_agrees_with_two_qubit_state_tomography(circuit) -> None:
119
119
  qubits = (Q0, Q1)
120
120
  sim = cirq.Simulator(seed=87539319)
121
121
  tomography_result = cirq.experiments.state_tomography(sim, qubits, circuit, repetitions=5000)
@@ -20,7 +20,7 @@ import sympy
20
20
  import cirq
21
21
 
22
22
 
23
- def test_init_result():
23
+ def test_init_result() -> None:
24
24
  data = pd.DataFrame(
25
25
  columns=['delay_ns', 'false_count', 'true_count'],
26
26
  index=range(2),
@@ -31,7 +31,7 @@ def test_init_result():
31
31
 
32
32
 
33
33
  @pytest.mark.usefixtures('closefigures')
34
- def test_plot_does_not_raise_error():
34
+ def test_plot_does_not_raise_error() -> None:
35
35
  class _TimeDependentDecay(cirq.NoiseModel):
36
36
  def noisy_moment(self, moment, system_qubits):
37
37
  duration = max(
@@ -55,7 +55,7 @@ def test_plot_does_not_raise_error():
55
55
  results.plot(include_fit=True)
56
56
 
57
57
 
58
- def test_result_eq():
58
+ def test_result_eq() -> None:
59
59
  eq = cirq.testing.EqualsTester()
60
60
  eq.make_equality_group(
61
61
  lambda: cirq.experiments.T1DecayResult(
@@ -75,7 +75,7 @@ def test_result_eq():
75
75
  )
76
76
 
77
77
 
78
- def test_sudden_decay_results():
78
+ def test_sudden_decay_results() -> None:
79
79
  class _SuddenDecay(cirq.NoiseModel):
80
80
  def noisy_moment(self, moment, system_qubits):
81
81
  duration = max(
@@ -107,7 +107,7 @@ def test_sudden_decay_results():
107
107
  )
108
108
 
109
109
 
110
- def test_all_on_results():
110
+ def test_all_on_results() -> None:
111
111
  results = cirq.experiments.t1_decay(
112
112
  sampler=cirq.Simulator(),
113
113
  qubit=cirq.GridQubit(0, 0),
@@ -126,7 +126,7 @@ def test_all_on_results():
126
126
  assert results == desired, f'{results.data=} {desired.data=}'
127
127
 
128
128
 
129
- def test_all_off_results():
129
+ def test_all_off_results() -> None:
130
130
  results = cirq.experiments.t1_decay(
131
131
  sampler=cirq.DensityMatrixSimulator(noise=cirq.amplitude_damp(1)),
132
132
  qubit=cirq.GridQubit(0, 0),
@@ -146,7 +146,7 @@ def test_all_off_results():
146
146
 
147
147
 
148
148
  @pytest.mark.usefixtures('closefigures')
149
- def test_curve_fit_plot_works():
149
+ def test_curve_fit_plot_works() -> None:
150
150
  good_fit = cirq.experiments.T1DecayResult(
151
151
  data=pd.DataFrame(
152
152
  columns=['delay_ns', 'false_count', 'true_count'],
@@ -159,7 +159,7 @@ def test_curve_fit_plot_works():
159
159
 
160
160
 
161
161
  @pytest.mark.parametrize('t1', [200.0, 500.0, 700.0])
162
- def test_noise_model_continous(t1):
162
+ def test_noise_model_continous(t1) -> None:
163
163
  class GradualDecay(cirq.NoiseModel):
164
164
  def __init__(self, t1: float):
165
165
  self.t1 = t1
@@ -193,7 +193,7 @@ def test_noise_model_continous(t1):
193
193
 
194
194
 
195
195
  @pytest.mark.parametrize('gamma', [0.01, 0.05, 0.1])
196
- def test_noise_model_discrete(gamma):
196
+ def test_noise_model_discrete(gamma) -> None:
197
197
  results = cirq.experiments.t1_decay(
198
198
  sampler=cirq.DensityMatrixSimulator(
199
199
  noise=cirq.NoiseModel.from_noise_model_like(cirq.amplitude_damp(gamma))
@@ -212,7 +212,7 @@ def test_noise_model_discrete(gamma):
212
212
  np.testing.assert_allclose(probs, np.mean(probs), atol=0.2)
213
213
 
214
214
 
215
- def test_bad_args():
215
+ def test_bad_args() -> None:
216
216
  with pytest.raises(ValueError, match='repetitions <= 0'):
217
217
  _ = cirq.experiments.t1_decay(
218
218
  sampler=cirq.Simulator(),
@@ -253,7 +253,7 @@ def test_bad_args():
253
253
  )
254
254
 
255
255
 
256
- def test_str():
256
+ def test_str() -> None:
257
257
  result = cirq.experiments.T1DecayResult(
258
258
  data=pd.DataFrame(
259
259
  columns=['delay_ns', 'false_count', 'true_count'],
@@ -22,7 +22,7 @@ from cirq.interop.quirk.cells import arithmetic_cells
22
22
  from cirq.interop.quirk.cells.testing import assert_url_to_circuit_returns
23
23
 
24
24
 
25
- def test_arithmetic_comparison_gates():
25
+ def test_arithmetic_comparison_gates() -> None:
26
26
  with pytest.raises(ValueError, match='Missing input'):
27
27
  _ = quirk_url_to_circuit('https://algassert.com/quirk#circuit={"cols":[["^A<B"]]}')
28
28
  assert_url_to_circuit_returns(
@@ -73,7 +73,7 @@ def test_arithmetic_comparison_gates():
73
73
  )
74
74
 
75
75
 
76
- def test_arithmetic_unlisted_misc_gates():
76
+ def test_arithmetic_unlisted_misc_gates() -> None:
77
77
  assert_url_to_circuit_returns(
78
78
  '{"cols":[["^=A3",1,1,"inputA2"]]}',
79
79
  maps={
@@ -141,7 +141,7 @@ def test_arithmetic_unlisted_misc_gates():
141
141
  )
142
142
 
143
143
 
144
- def test_arithmetic_addition_gates():
144
+ def test_arithmetic_addition_gates() -> None:
145
145
  assert_url_to_circuit_returns(
146
146
  '{"cols":[["inc3"]]}',
147
147
  diagram="""
@@ -164,7 +164,7 @@ def test_arithmetic_addition_gates():
164
164
  )
165
165
 
166
166
 
167
- def test_arithmetic_multiply_accumulate_gates():
167
+ def test_arithmetic_multiply_accumulate_gates() -> None:
168
168
  assert_url_to_circuit_returns(
169
169
  '{"cols":[["+=AA4",1,1,1,"inputA2"]]}',
170
170
  maps={0b_0000_00: 0b_0000_00, 0b_0100_10: 0b_1000_10, 0b_1000_11: 0b_0001_11},
@@ -186,7 +186,7 @@ def test_arithmetic_multiply_accumulate_gates():
186
186
  )
187
187
 
188
188
 
189
- def test_modular_arithmetic_modulus_size():
189
+ def test_modular_arithmetic_modulus_size() -> None:
190
190
  with pytest.raises(ValueError, match='too small for modulus'):
191
191
  _ = quirk_url_to_circuit(
192
192
  'https://algassert.com/quirk#circuit={"cols":['
@@ -208,7 +208,7 @@ def test_modular_arithmetic_modulus_size():
208
208
  assert_url_to_circuit_returns('{"cols":[["incmodR2",1,"inputR2"]]}')
209
209
 
210
210
 
211
- def test_arithmetic_modular_addition_gates():
211
+ def test_arithmetic_modular_addition_gates() -> None:
212
212
  assert_url_to_circuit_returns(
213
213
  '{"cols":[[{"id":"setR","arg":16}],["incmodR4"]]}',
214
214
  diagram="""
@@ -242,7 +242,7 @@ def test_arithmetic_modular_addition_gates():
242
242
  )
243
243
 
244
244
 
245
- def test_arithmetic_modular_multiply_accumulate_gates():
245
+ def test_arithmetic_modular_multiply_accumulate_gates() -> None:
246
246
  assert_url_to_circuit_returns(
247
247
  '{"cols":[[{"id":"setR","arg":5},{"id":"setA","arg":3},'
248
248
  '{"id":"setB","arg":4}],["+ABmodR4"]]}',
@@ -256,7 +256,7 @@ def test_arithmetic_modular_multiply_accumulate_gates():
256
256
  )
257
257
 
258
258
 
259
- def test_arithmetic_multiply_gates():
259
+ def test_arithmetic_multiply_gates() -> None:
260
260
  assert_url_to_circuit_returns(
261
261
  '{"cols":[[{"id":"setA","arg":3}],["*A4"]]}', maps={0: 0, 1: 3, 3: 9, 9: 11, 11: 1}
262
262
  )
@@ -273,7 +273,7 @@ def test_arithmetic_multiply_gates():
273
273
  )
274
274
 
275
275
 
276
- def test_arithmetic_modular_multiply_gates():
276
+ def test_arithmetic_modular_multiply_gates() -> None:
277
277
  assert_url_to_circuit_returns(
278
278
  '{"cols":[[{"id":"setA","arg":3},{"id":"setR","arg":7}],["*AmodR4"]]}',
279
279
  maps={0: 0, 1: 3, 3: 2, 2: 6, 6: 4, 4: 5, 5: 1, 7: 7, 15: 15},
@@ -294,7 +294,7 @@ def test_arithmetic_modular_multiply_gates():
294
294
  )
295
295
 
296
296
 
297
- def test_arithmetic_modular_exponentiation_gates():
297
+ def test_arithmetic_modular_exponentiation_gates() -> None:
298
298
  assert_url_to_circuit_returns(
299
299
  '{"cols":[[{"id":"setA","arg":5},{"id":"setB","arg":3},'
300
300
  '{"id":"setR","arg":7}],["*BToAmodR4"]]}',
@@ -318,7 +318,7 @@ def test_arithmetic_modular_exponentiation_gates():
318
318
  )
319
319
 
320
320
 
321
- def test_repr():
321
+ def test_repr() -> None:
322
322
  circuit = quirk_url_to_circuit(
323
323
  'https://algassert.com/quirk#circuit={"cols":'
324
324
  '['
@@ -336,7 +336,7 @@ def test_repr():
336
336
  )
337
337
 
338
338
 
339
- def test_with_registers():
339
+ def test_with_registers() -> None:
340
340
  circuit = quirk_url_to_circuit(
341
341
  'https://algassert.com/quirk#circuit={"cols":'
342
342
  '['
@@ -363,7 +363,7 @@ def test_with_registers():
363
363
  )
364
364
 
365
365
 
366
- def test_helpers():
366
+ def test_helpers() -> None:
367
367
  f = arithmetic_cells._popcnt
368
368
  assert f(0) == 0
369
369
  assert f(1) == 1
@@ -414,7 +414,7 @@ def test_helpers():
414
414
  assert h(7, 16) == 7
415
415
 
416
416
 
417
- def test_with_line_qubits_mapped_to():
417
+ def test_with_line_qubits_mapped_to() -> None:
418
418
  a, b, c, d, e = cirq.LineQubit.range(5)
419
419
  a2, b2, c2, d2, e2 = cirq.NamedQubit.range(5, prefix='p')
420
420
 
@@ -16,7 +16,7 @@ import cirq
16
16
  from cirq.interop.quirk.cells.testing import assert_url_to_circuit_returns
17
17
 
18
18
 
19
- def test_controls():
19
+ def test_controls() -> None:
20
20
  a, b = cirq.LineQubit.range(2)
21
21
 
22
22
  assert_url_to_circuit_returns('{"cols":[["•","X"]]}', cirq.Circuit(cirq.X(b).controlled_by(a)))
@@ -86,7 +86,7 @@ def test_controls():
86
86
  )
87
87
 
88
88
 
89
- def test_parity_controls():
89
+ def test_parity_controls() -> None:
90
90
  a, b, c, d, e = cirq.LineQubit.range(5)
91
91
 
92
92
  assert_url_to_circuit_returns(
@@ -106,7 +106,7 @@ def test_parity_controls():
106
106
  )
107
107
 
108
108
 
109
- def test_control_with_line_qubits_mapped_to():
109
+ def test_control_with_line_qubits_mapped_to() -> None:
110
110
  a, b = cirq.LineQubit.range(2)
111
111
  a2, b2 = cirq.NamedQubit.range(2, prefix='q')
112
112
  cell = cirq.interop.quirk.cells.control_cells.ControlCell(a, [cirq.Y(b) ** 0.5])
@@ -115,7 +115,7 @@ def test_control_with_line_qubits_mapped_to():
115
115
  assert cell.with_line_qubits_mapped_to([a2, b2]) == mapped_cell
116
116
 
117
117
 
118
- def test_parity_control_with_line_qubits_mapped_to():
118
+ def test_parity_control_with_line_qubits_mapped_to() -> None:
119
119
  a, b, c = cirq.LineQubit.range(3)
120
120
  a2, b2, c2 = cirq.NamedQubit.range(3, prefix='q')
121
121
  cell = cirq.interop.quirk.cells.control_cells.ParityControlCell([a, b], [cirq.Y(c) ** 0.5])
@@ -126,7 +126,7 @@ def test_parity_control_with_line_qubits_mapped_to():
126
126
  assert cell.with_line_qubits_mapped_to([a2, b2, c2]) == mapped_cell
127
127
 
128
128
 
129
- def test_repr():
129
+ def test_repr() -> None:
130
130
  a, b, c = cirq.LineQubit.range(3)
131
131
  cirq.testing.assert_equivalent_repr(
132
132
  cirq.interop.quirk.cells.control_cells.ControlCell(a, [cirq.Y(b) ** 0.5])
@@ -18,7 +18,7 @@ import cirq
18
18
  from cirq.interop.quirk.cells.testing import assert_url_to_circuit_returns
19
19
 
20
20
 
21
- def test_frequency_space_gates():
21
+ def test_frequency_space_gates() -> None:
22
22
  a, b, c = cirq.LineQubit.range(3)
23
23
 
24
24
  assert_url_to_circuit_returns('{"cols":[["QFT3"]]}', cirq.Circuit(cirq.qft(a, b, c)))
@@ -16,7 +16,7 @@ import cirq
16
16
  from cirq.interop.quirk.cells.testing import assert_url_to_circuit_returns
17
17
 
18
18
 
19
- def test_displays():
19
+ def test_displays() -> None:
20
20
  assert_url_to_circuit_returns(
21
21
  '{"cols":[["Amps2"],[1,"Amps3"],["Chance"],'
22
22
  '["Chance2"],["Density"],["Density3"],'
@@ -19,12 +19,12 @@ from cirq.interop.quirk.cells.input_cells import SetDefaultInputCell
19
19
  from cirq.interop.quirk.cells.testing import assert_url_to_circuit_returns
20
20
 
21
21
 
22
- def test_missing_input_cell():
22
+ def test_missing_input_cell() -> None:
23
23
  with pytest.raises(ValueError, match='Missing input'):
24
24
  _ = quirk_url_to_circuit('https://algassert.com/quirk#circuit={"cols":[["+=A2"]]}')
25
25
 
26
26
 
27
- def test_input_cell():
27
+ def test_input_cell() -> None:
28
28
  assert_url_to_circuit_returns(
29
29
  '{"cols":[["inputA4",1,1,1,"+=A4"]]}', maps={0x_0_0: 0x_0_0, 0x_2_3: 0x_2_5}
30
30
  )
@@ -41,7 +41,7 @@ def test_input_cell():
41
41
  )
42
42
 
43
43
 
44
- def test_reversed_input_cell():
44
+ def test_reversed_input_cell() -> None:
45
45
  assert_url_to_circuit_returns(
46
46
  '{"cols":[["revinputA4",1,1,1,"+=A4"]]}',
47
47
  maps={0x_0_0: 0x_0_0, 0x_2_3: 0x_2_7, 0x_1_3: 0x_1_B},
@@ -59,7 +59,7 @@ def test_reversed_input_cell():
59
59
  )
60
60
 
61
61
 
62
- def test_set_default_input_cell():
62
+ def test_set_default_input_cell() -> None:
63
63
  # Later column.
64
64
  assert_url_to_circuit_returns(
65
65
  '{"cols":[[{"id":"setA","arg":11}],["+=A4"]]}', maps={0: 11, 4: 15, 5: 0}
@@ -98,6 +98,6 @@ def test_set_default_input_cell():
98
98
  )
99
99
 
100
100
 
101
- def test_with_line_qubits_mapped_to():
101
+ def test_with_line_qubits_mapped_to() -> None:
102
102
  cell = SetDefaultInputCell('a', 5)
103
103
  assert cell.with_line_qubits_mapped_to([]) is cell
@@ -20,7 +20,7 @@ from cirq import quirk_url_to_circuit
20
20
  from cirq.interop.quirk.cells.testing import assert_url_to_circuit_returns
21
21
 
22
22
 
23
- def test_input_rotation_cells():
23
+ def test_input_rotation_cells() -> None:
24
24
  with pytest.raises(ValueError, match='classical constant'):
25
25
  _ = quirk_url_to_circuit(
26
26
  'https://algassert.com/quirk#circuit={"cols":[["Z^(A/2^n)",{"id":"setA","arg":3}]]}'
@@ -105,7 +105,7 @@ def test_input_rotation_cells():
105
105
  )
106
106
 
107
107
 
108
- def test_input_rotation_cells_repr():
108
+ def test_input_rotation_cells_repr() -> None:
109
109
  circuit = quirk_url_to_circuit(
110
110
  'http://algassert.com/quirk#circuit={"cols":[["•","X^(-A/2^n)","inputA2"]]}'
111
111
  )
@@ -113,7 +113,7 @@ def test_input_rotation_cells_repr():
113
113
  cirq.testing.assert_equivalent_repr(op)
114
114
 
115
115
 
116
- def test_validation():
116
+ def test_validation() -> None:
117
117
  with pytest.raises(ValueError, match='sign'):
118
118
  _ = cirq.interop.quirk.QuirkInputRotationOperation(
119
119
  identifier='xxx',
@@ -123,7 +123,7 @@ def test_validation():
123
123
  )
124
124
 
125
125
 
126
- def test_input_rotation_with_qubits():
126
+ def test_input_rotation_with_qubits() -> None:
127
127
  a, b, c, d, e = cirq.LineQubit.range(5)
128
128
  x, y, z, t, w = cirq.LineQubit.range(10, 15)
129
129
  op = cirq.interop.quirk.QuirkInputRotationOperation(
@@ -143,7 +143,7 @@ def test_input_rotation_with_qubits():
143
143
  )
144
144
 
145
145
 
146
- def test_input_rotation_cell_with_qubits():
146
+ def test_input_rotation_cell_with_qubits() -> None:
147
147
  a, b, c, d, e = cirq.LineQubit.range(5)
148
148
  x, y, z, t, w = cirq.LineQubit.range(10, 15)
149
149
  cell = cirq.interop.quirk.cells.input_rotation_cells.InputRotationCell(
@@ -162,7 +162,7 @@ def test_input_rotation_cell_with_qubits():
162
162
  )
163
163
 
164
164
 
165
- def test_input_rotation_cell_with_qubits_before_register_specified():
165
+ def test_input_rotation_cell_with_qubits_before_register_specified() -> None:
166
166
  d, e = cirq.LineQubit.range(3, 5)
167
167
  x, y, z, t, w = cirq.LineQubit.range(10, 15)
168
168
  cell = cirq.interop.quirk.cells.input_rotation_cells.InputRotationCell(
@@ -181,7 +181,7 @@ def test_input_rotation_cell_with_qubits_before_register_specified():
181
181
  )
182
182
 
183
183
 
184
- def test_repr():
184
+ def test_repr() -> None:
185
185
  a, b, c, d, e = cirq.LineQubit.range(5)
186
186
  cirq.testing.assert_equivalent_repr(
187
187
  cirq.interop.quirk.cells.input_rotation_cells.InputRotationCell(
@@ -16,7 +16,7 @@ import cirq
16
16
  from cirq.interop.quirk.cells.testing import assert_url_to_circuit_returns
17
17
 
18
18
 
19
- def test_measurement_gates():
19
+ def test_measurement_gates() -> None:
20
20
  a, b, c = cirq.LineQubit.range(3)
21
21
  assert_url_to_circuit_returns(
22
22
  '{"cols":[["Measure","Measure"],["Measure","Measure"]]}',