cirq-core 1.6.0.dev20250508231110__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.dev20250508231110.dist-info → cirq_core-1.6.0.dev20250512192405.dist-info}/METADATA +1 -1
  164. {cirq_core-1.6.0.dev20250508231110.dist-info → cirq_core-1.6.0.dev20250512192405.dist-info}/RECORD +167 -167
  165. {cirq_core-1.6.0.dev20250508231110.dist-info → cirq_core-1.6.0.dev20250512192405.dist-info}/WHEEL +1 -1
  166. {cirq_core-1.6.0.dev20250508231110.dist-info → cirq_core-1.6.0.dev20250512192405.dist-info}/licenses/LICENSE +0 -0
  167. {cirq_core-1.6.0.dev20250508231110.dist-info → cirq_core-1.6.0.dev20250512192405.dist-info}/top_level.txt +0 -0
@@ -22,17 +22,17 @@ import cirq
22
22
 
23
23
 
24
24
  @pytest.mark.parametrize('eigen_gate_type', [cirq.XXPowGate, cirq.YYPowGate, cirq.ZZPowGate])
25
- def test_eigen_gates_consistent_protocols(eigen_gate_type):
25
+ def test_eigen_gates_consistent_protocols(eigen_gate_type) -> None:
26
26
  cirq.testing.assert_eigengate_implements_consistent_protocols(eigen_gate_type)
27
27
 
28
28
 
29
- def test_xx_init():
29
+ def test_xx_init() -> None:
30
30
  assert cirq.XXPowGate(exponent=1).exponent == 1
31
31
  v = cirq.XXPowGate(exponent=0.5)
32
32
  assert v.exponent == 0.5
33
33
 
34
34
 
35
- def test_xx_eq():
35
+ def test_xx_eq() -> None:
36
36
  eq = cirq.testing.EqualsTester()
37
37
  eq.add_equality_group(
38
38
  cirq.XX,
@@ -49,24 +49,24 @@ def test_xx_eq():
49
49
  eq.add_equality_group(iXX**2.5, iXX**6.5)
50
50
 
51
51
 
52
- def test_xx_pow():
52
+ def test_xx_pow() -> None:
53
53
  assert cirq.XX**0.5 != cirq.XX**-0.5
54
54
  assert cirq.XX**-1 == cirq.XX
55
55
  assert (cirq.XX**-1) ** 0.5 == cirq.XX**-0.5
56
56
 
57
57
 
58
- def test_xx_str():
58
+ def test_xx_str() -> None:
59
59
  assert str(cirq.XX) == 'XX'
60
60
  assert str(cirq.XX**0.5) == 'XX**0.5'
61
61
  assert str(cirq.XXPowGate(global_shift=0.1)) == 'XX'
62
62
 
63
63
 
64
- def test_xx_repr():
64
+ def test_xx_repr() -> None:
65
65
  assert repr(cirq.XXPowGate()) == 'cirq.XX'
66
66
  assert repr(cirq.XXPowGate(exponent=0.5)) == '(cirq.XX**0.5)'
67
67
 
68
68
 
69
- def test_xx_matrix():
69
+ def test_xx_matrix() -> None:
70
70
  np.testing.assert_allclose(
71
71
  cirq.unitary(cirq.XX),
72
72
  np.array([[0, 0, 0, 1], [0, 0, 1, 0], [0, 1, 0, 0], [1, 0, 0, 0]]),
@@ -82,7 +82,7 @@ def test_xx_matrix():
82
82
  )
83
83
 
84
84
 
85
- def test_xx_diagrams():
85
+ def test_xx_diagrams() -> None:
86
86
  a = cirq.NamedQubit('a')
87
87
  b = cirq.NamedQubit('b')
88
88
  circuit = cirq.Circuit(cirq.XX(a, b), cirq.XX(a, b) ** 3, cirq.XX(a, b) ** 0.5)
@@ -96,13 +96,13 @@ b: ───XX───XX───XX^0.5───
96
96
  )
97
97
 
98
98
 
99
- def test_yy_init():
99
+ def test_yy_init() -> None:
100
100
  assert cirq.YYPowGate(exponent=1).exponent == 1
101
101
  v = cirq.YYPowGate(exponent=0.5)
102
102
  assert v.exponent == 0.5
103
103
 
104
104
 
105
- def test_yy_eq():
105
+ def test_yy_eq() -> None:
106
106
  eq = cirq.testing.EqualsTester()
107
107
  eq.add_equality_group(
108
108
  cirq.YY,
@@ -118,13 +118,13 @@ def test_yy_eq():
118
118
  eq.add_equality_group(iYY**2.5, iYY**6.5)
119
119
 
120
120
 
121
- def test_yy_pow():
121
+ def test_yy_pow() -> None:
122
122
  assert cirq.YY**0.5 != cirq.YY**-0.5
123
123
  assert cirq.YY**-1 == cirq.YY
124
124
  assert (cirq.YY**-1) ** 0.5 == cirq.YY**-0.5
125
125
 
126
126
 
127
- def test_yy_str():
127
+ def test_yy_str() -> None:
128
128
  assert str(cirq.YY) == 'YY'
129
129
  assert str(cirq.YY**0.5) == 'YY**0.5'
130
130
  assert str(cirq.YYPowGate(global_shift=0.1)) == 'YY'
@@ -133,12 +133,12 @@ def test_yy_str():
133
133
  assert str(iYY) == 'YY'
134
134
 
135
135
 
136
- def test_yy_repr():
136
+ def test_yy_repr() -> None:
137
137
  assert repr(cirq.YYPowGate()) == 'cirq.YY'
138
138
  assert repr(cirq.YYPowGate(exponent=0.5)) == '(cirq.YY**0.5)'
139
139
 
140
140
 
141
- def test_yy_matrix():
141
+ def test_yy_matrix() -> None:
142
142
  np.testing.assert_allclose(
143
143
  cirq.unitary(cirq.YY),
144
144
  np.array([[0, 0, 0, -1], [0, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 0, 0]]),
@@ -154,7 +154,7 @@ def test_yy_matrix():
154
154
  )
155
155
 
156
156
 
157
- def test_yy_diagrams():
157
+ def test_yy_diagrams() -> None:
158
158
  a = cirq.NamedQubit('a')
159
159
  b = cirq.NamedQubit('b')
160
160
  circuit = cirq.Circuit(cirq.YY(a, b), cirq.YY(a, b) ** 3, cirq.YY(a, b) ** 0.5)
@@ -168,13 +168,13 @@ b: ───YY───YY───YY^0.5───
168
168
  )
169
169
 
170
170
 
171
- def test_zz_init():
171
+ def test_zz_init() -> None:
172
172
  assert cirq.ZZPowGate(exponent=1).exponent == 1
173
173
  v = cirq.ZZPowGate(exponent=0.5)
174
174
  assert v.exponent == 0.5
175
175
 
176
176
 
177
- def test_zz_eq():
177
+ def test_zz_eq() -> None:
178
178
  eq = cirq.testing.EqualsTester()
179
179
  eq.add_equality_group(
180
180
  cirq.ZZ,
@@ -190,19 +190,19 @@ def test_zz_eq():
190
190
  eq.add_equality_group(iZZ**2.5, iZZ**6.5)
191
191
 
192
192
 
193
- def test_zz_pow():
193
+ def test_zz_pow() -> None:
194
194
  assert cirq.ZZ**0.5 != cirq.ZZ**-0.5
195
195
  assert cirq.ZZ**-1 == cirq.ZZ
196
196
  assert (cirq.ZZ**-1) ** 0.5 == cirq.ZZ**-0.5
197
197
 
198
198
 
199
- def test_zz_phase_by():
199
+ def test_zz_phase_by() -> None:
200
200
  assert cirq.phase_by(cirq.ZZ, 0.25, 0) == cirq.phase_by(cirq.ZZ, 0.25, 1) == cirq.ZZ
201
201
  assert cirq.phase_by(cirq.ZZ**0.5, 0.25, 0) == cirq.ZZ**0.5
202
202
  assert cirq.phase_by(cirq.ZZ**-0.5, 0.25, 1) == cirq.ZZ**-0.5
203
203
 
204
204
 
205
- def test_zz_str():
205
+ def test_zz_str() -> None:
206
206
  assert str(cirq.ZZ) == 'ZZ'
207
207
  assert str(cirq.ZZ**0.5) == 'ZZ**0.5'
208
208
  assert str(cirq.ZZPowGate(global_shift=0.1)) == 'ZZ'
@@ -211,12 +211,12 @@ def test_zz_str():
211
211
  assert str(iZZ) == 'ZZ'
212
212
 
213
213
 
214
- def test_zz_repr():
214
+ def test_zz_repr() -> None:
215
215
  assert repr(cirq.ZZPowGate()) == 'cirq.ZZ'
216
216
  assert repr(cirq.ZZPowGate(exponent=0.5)) == '(cirq.ZZ**0.5)'
217
217
 
218
218
 
219
- def test_zz_matrix():
219
+ def test_zz_matrix() -> None:
220
220
  np.testing.assert_allclose(
221
221
  cirq.unitary(cirq.ZZ),
222
222
  np.array([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]]),
@@ -232,7 +232,7 @@ def test_zz_matrix():
232
232
  )
233
233
 
234
234
 
235
- def test_zz_diagrams():
235
+ def test_zz_diagrams() -> None:
236
236
  a = cirq.NamedQubit('a')
237
237
  b = cirq.NamedQubit('b')
238
238
  circuit = cirq.Circuit(cirq.ZZ(a, b), cirq.ZZ(a, b) ** 3, cirq.ZZ(a, b) ** 0.5)
@@ -246,7 +246,7 @@ b: ───ZZ───ZZ───ZZ^0.5───
246
246
  )
247
247
 
248
248
 
249
- def test_trace_distance():
249
+ def test_trace_distance() -> None:
250
250
  foo = sympy.Symbol('foo')
251
251
  assert cirq.trace_distance_bound(cirq.XX**foo) == 1.0
252
252
  assert cirq.trace_distance_bound(cirq.YY**foo) == 1.0
@@ -256,7 +256,7 @@ def test_trace_distance():
256
256
  assert cirq.approx_eq(cirq.trace_distance_bound(cirq.ZZ ** (1 / 3)), np.sin(np.pi / 6))
257
257
 
258
258
 
259
- def test_ms_arguments():
259
+ def test_ms_arguments() -> None:
260
260
  eq_tester = cirq.testing.EqualsTester()
261
261
  eq_tester.add_equality_group(
262
262
  cirq.ms(np.pi / 2), cirq.MSGate(rads=np.pi / 2), cirq.XXPowGate(global_shift=-0.5)
@@ -268,7 +268,7 @@ def test_ms_arguments():
268
268
  eq_tester.add_equality_group(cirq.XX**0.5)
269
269
 
270
270
 
271
- def test_ms_equal_up_to_global_phase():
271
+ def test_ms_equal_up_to_global_phase() -> None:
272
272
  assert cirq.equal_up_to_global_phase(cirq.ms(np.pi / 2), cirq.XX)
273
273
  assert cirq.equal_up_to_global_phase(cirq.ms(np.pi / 4), cirq.XX**0.5)
274
274
  assert not cirq.equal_up_to_global_phase(cirq.ms(np.pi / 4), cirq.XX)
@@ -278,7 +278,7 @@ def test_ms_equal_up_to_global_phase():
278
278
  assert cirq.ms(np.pi / 4) not in cirq.GateFamily(cirq.XX)
279
279
 
280
280
 
281
- def test_ms_str():
281
+ def test_ms_str() -> None:
282
282
  ms = cirq.ms(np.pi / 2)
283
283
  assert str(ms) == 'MS(π/2)'
284
284
  assert str(cirq.ms(np.pi)) == 'MS(2.0π/2)'
@@ -287,7 +287,7 @@ def test_ms_str():
287
287
  assert str(ms**-1) == 'MS(-1.0π/2)'
288
288
 
289
289
 
290
- def test_ms_matrix():
290
+ def test_ms_matrix() -> None:
291
291
  s = np.sqrt(0.5)
292
292
  # yapf: disable
293
293
  np.testing.assert_allclose(cirq.unitary(cirq.ms(np.pi/4)),
@@ -300,7 +300,7 @@ def test_ms_matrix():
300
300
  np.testing.assert_allclose(cirq.unitary(cirq.ms(np.pi)), np.diag([-1, -1, -1, -1]), atol=1e-8)
301
301
 
302
302
 
303
- def test_ms_repr():
303
+ def test_ms_repr() -> None:
304
304
  assert repr(cirq.ms(np.pi / 2)) == 'cirq.ms(np.pi/2)'
305
305
  assert repr(cirq.ms(np.pi / 4)) == 'cirq.ms(0.5*np.pi/2)'
306
306
  cirq.testing.assert_equivalent_repr(cirq.ms(np.pi / 4))
@@ -309,7 +309,7 @@ def test_ms_repr():
309
309
  assert repr(ms**-0.5) == 'cirq.ms(-0.5*np.pi/2)'
310
310
 
311
311
 
312
- def test_ms_diagrams():
312
+ def test_ms_diagrams() -> None:
313
313
  a = cirq.NamedQubit('a')
314
314
  b = cirq.NamedQubit('b')
315
315
  circuit = cirq.Circuit(cirq.SWAP(a, b), cirq.X(a), cirq.Y(a), cirq.ms(np.pi).on(a, b))
@@ -323,7 +323,7 @@ b: ───×───────────MS(π)───
323
323
  )
324
324
 
325
325
 
326
- def test_json_serialization():
326
+ def test_json_serialization() -> None:
327
327
  assert cirq.read_json(json_text=cirq.to_json(cirq.ms(np.pi / 2))) == cirq.ms(np.pi / 2)
328
328
 
329
329
 
@@ -332,7 +332,9 @@ def test_json_serialization():
332
332
  'exponent,is_clifford',
333
333
  ((0, True), (0.5, True), (0.75, False), (1, True), (1.5, True), (-1.5, True)),
334
334
  )
335
- def test_clifford_protocols(gate_cls: type[cirq.EigenGate], exponent: float, is_clifford: bool):
335
+ def test_clifford_protocols(
336
+ gate_cls: type[cirq.EigenGate], exponent: float, is_clifford: bool
337
+ ) -> None:
336
338
  gate = gate_cls(exponent=exponent)
337
339
  assert hasattr(gate, '_decompose_into_clifford_with_qubits_')
338
340
  if is_clifford:
@@ -20,14 +20,14 @@ import pytest
20
20
  import cirq
21
21
 
22
22
 
23
- def test_equals():
23
+ def test_equals() -> None:
24
24
  eq = cirq.testing.EqualsTester()
25
25
  eq.add_equality_group(cirq.X, cirq.ops.pauli_gates.X, cirq.XPowGate())
26
26
  eq.add_equality_group(cirq.Y, cirq.ops.pauli_gates.Y, cirq.YPowGate())
27
27
  eq.add_equality_group(cirq.Z, cirq.ops.pauli_gates.Z, cirq.ZPowGate())
28
28
 
29
29
 
30
- def test_phased_pauli_product():
30
+ def test_phased_pauli_product() -> None:
31
31
  assert cirq.X.phased_pauli_product(cirq.I) == (1, cirq.X)
32
32
  assert cirq.X.phased_pauli_product(cirq.X) == (1, cirq.I)
33
33
  assert cirq.X.phased_pauli_product(cirq.Y) == (1j, cirq.Z)
@@ -44,7 +44,7 @@ def test_phased_pauli_product():
44
44
  assert cirq.Z.phased_pauli_product(cirq.Z) == (1, cirq.I)
45
45
 
46
46
 
47
- def test_isinstance():
47
+ def test_isinstance() -> None:
48
48
  assert isinstance(cirq.X, cirq.XPowGate)
49
49
  assert isinstance(cirq.Y, cirq.YPowGate)
50
50
  assert isinstance(cirq.Z, cirq.ZPowGate)
@@ -59,14 +59,14 @@ def test_isinstance():
59
59
  assert not isinstance(cirq.Z, cirq.YPowGate)
60
60
 
61
61
 
62
- def test_by_index():
62
+ def test_by_index() -> None:
63
63
  eq = cirq.testing.EqualsTester()
64
64
  eq.add_equality_group(cirq.X, *[cirq.Pauli.by_index(i) for i in (-3, 0, 3, 6)])
65
65
  eq.add_equality_group(cirq.Y, *[cirq.Pauli.by_index(i) for i in (-2, 1, 4, 7)])
66
66
  eq.add_equality_group(cirq.Z, *[cirq.Pauli.by_index(i) for i in (-1, 2, 5, 8)])
67
67
 
68
68
 
69
- def test_relative_index():
69
+ def test_relative_index() -> None:
70
70
  assert cirq.X.relative_index(cirq.X) == 0
71
71
  assert cirq.X.relative_index(cirq.Y) == -1
72
72
  assert cirq.X.relative_index(cirq.Z) == 1
@@ -78,7 +78,7 @@ def test_relative_index():
78
78
  assert cirq.Z.relative_index(cirq.Z) == 0
79
79
 
80
80
 
81
- def test_by_relative_index():
81
+ def test_by_relative_index() -> None:
82
82
  assert cirq.Pauli.by_relative_index(cirq.X, -1) == cirq.Z
83
83
  assert cirq.Pauli.by_relative_index(cirq.X, 0) == cirq.X
84
84
  assert cirq.Pauli.by_relative_index(cirq.X, 1) == cirq.Y
@@ -96,7 +96,7 @@ def test_by_relative_index():
96
96
  assert cirq.Pauli.by_relative_index(cirq.Z, 3) == cirq.Z
97
97
 
98
98
 
99
- def test_too_many_qubits():
99
+ def test_too_many_qubits() -> None:
100
100
  a, b = cirq.LineQubit.range(2)
101
101
  with pytest.raises(ValueError, match='single qubit'):
102
102
  _ = cirq.X.on(a, b)
@@ -106,14 +106,14 @@ def test_too_many_qubits():
106
106
  _ = x.with_qubits(a, b)
107
107
 
108
108
 
109
- def test_relative_index_consistency():
109
+ def test_relative_index_consistency() -> None:
110
110
  for pauli_1 in (cirq.X, cirq.Y, cirq.Z):
111
111
  for pauli_2 in (cirq.X, cirq.Y, cirq.Z):
112
112
  shift = pauli_2.relative_index(pauli_1)
113
113
  assert cirq.Pauli.by_relative_index(pauli_1, shift) == pauli_2
114
114
 
115
115
 
116
- def test_gt():
116
+ def test_gt() -> None:
117
117
  assert not cirq.X > cirq.X
118
118
  assert not cirq.X > cirq.Y
119
119
  assert cirq.X > cirq.Z
@@ -125,12 +125,12 @@ def test_gt():
125
125
  assert not cirq.Z > cirq.Z
126
126
 
127
127
 
128
- def test_gt_other_type():
128
+ def test_gt_other_type() -> None:
129
129
  with pytest.raises(TypeError):
130
130
  _ = cirq.X > object()
131
131
 
132
132
 
133
- def test_lt():
133
+ def test_lt() -> None:
134
134
  assert not cirq.X < cirq.X
135
135
  assert cirq.X < cirq.Y
136
136
  assert not cirq.X < cirq.Z
@@ -142,24 +142,24 @@ def test_lt():
142
142
  assert not cirq.Z < cirq.Z
143
143
 
144
144
 
145
- def test_lt_other_type():
145
+ def test_lt_other_type() -> None:
146
146
  with pytest.raises(TypeError):
147
147
  _ = cirq.X < object()
148
148
 
149
149
 
150
- def test_str():
150
+ def test_str() -> None:
151
151
  assert str(cirq.X) == 'X'
152
152
  assert str(cirq.Y) == 'Y'
153
153
  assert str(cirq.Z) == 'Z'
154
154
 
155
155
 
156
- def test_repr():
156
+ def test_repr() -> None:
157
157
  assert repr(cirq.X) == 'cirq.X'
158
158
  assert repr(cirq.Y) == 'cirq.Y'
159
159
  assert repr(cirq.Z) == 'cirq.Z'
160
160
 
161
161
 
162
- def test_third():
162
+ def test_third() -> None:
163
163
  assert cirq.X.third(cirq.Y) == cirq.Z
164
164
  assert cirq.Y.third(cirq.X) == cirq.Z
165
165
  assert cirq.Y.third(cirq.Z) == cirq.X
@@ -172,7 +172,7 @@ def test_third():
172
172
  assert cirq.Z.third(cirq.Z) == cirq.Z
173
173
 
174
174
 
175
- def test_commutes():
175
+ def test_commutes() -> None:
176
176
  for A, B in itertools.product([cirq.X, cirq.Y, cirq.Z], repeat=2):
177
177
  assert cirq.commutes(A, B) == (A == B)
178
178
  with pytest.raises(TypeError):
@@ -181,19 +181,19 @@ def test_commutes():
181
181
  assert cirq.commutes(cirq.Z, cirq.read_json(json_text=cirq.to_json(cirq.Z)))
182
182
 
183
183
 
184
- def test_unitary():
184
+ def test_unitary() -> None:
185
185
  np.testing.assert_equal(cirq.unitary(cirq.X), cirq.unitary(cirq.X))
186
186
  np.testing.assert_equal(cirq.unitary(cirq.Y), cirq.unitary(cirq.Y))
187
187
  np.testing.assert_equal(cirq.unitary(cirq.Z), cirq.unitary(cirq.Z))
188
188
 
189
189
 
190
- def test_apply_unitary():
190
+ def test_apply_unitary() -> None:
191
191
  cirq.testing.assert_has_consistent_apply_unitary(cirq.X)
192
192
  cirq.testing.assert_has_consistent_apply_unitary(cirq.Y)
193
193
  cirq.testing.assert_has_consistent_apply_unitary(cirq.Z)
194
194
 
195
195
 
196
- def test_identity_multiplication():
196
+ def test_identity_multiplication() -> None:
197
197
  a, b, c = cirq.LineQubit.range(3)
198
198
  assert cirq.X(a) * cirq.I(a) == cirq.X(a)
199
199
  assert cirq.X(a) * cirq.I(b) == cirq.X(a)
@@ -207,7 +207,7 @@ def test_identity_multiplication():
207
207
  _ = cirq.I(a) * str(cirq.Y(b))
208
208
 
209
209
 
210
- def test_powers():
210
+ def test_powers() -> None:
211
211
  assert isinstance(cirq.X, cirq.Pauli)
212
212
  assert isinstance(cirq.Y, cirq.Pauli)
213
213
  assert isinstance(cirq.Z, cirq.Pauli)
@@ -32,11 +32,11 @@ def _all_interaction_gates(exponents=(1,)):
32
32
 
33
33
 
34
34
  @pytest.mark.parametrize('gate', _all_interaction_gates())
35
- def test_pauli_interaction_gates_consistent_protocols(gate):
35
+ def test_pauli_interaction_gates_consistent_protocols(gate) -> None:
36
36
  cirq.testing.assert_implements_consistent_protocols(gate)
37
37
 
38
38
 
39
- def test_eq_ne_and_hash():
39
+ def test_eq_ne_and_hash() -> None:
40
40
  eq = cirq.testing.EqualsTester()
41
41
  for pauli0, invert0, pauli1, invert1, e in itertools.product(
42
42
  _paulis, _bools, _paulis, _bools, (0.125, -0.25, 1)
@@ -46,7 +46,7 @@ def test_eq_ne_and_hash():
46
46
  )
47
47
 
48
48
 
49
- def test_exponent_shifts_are_equal():
49
+ def test_exponent_shifts_are_equal() -> None:
50
50
  eq = cirq.testing.EqualsTester()
51
51
  eq.add_equality_group(
52
52
  cirq.PauliInteractionGate(cirq.X, False, cirq.X, False, exponent=e)
@@ -67,7 +67,7 @@ def test_exponent_shifts_are_equal():
67
67
 
68
68
 
69
69
  @pytest.mark.parametrize('gate', _all_interaction_gates(exponents=(0.1, -0.25, 0.5, 1)))
70
- def test_interchangeable_qubits(gate):
70
+ def test_interchangeable_qubits(gate) -> None:
71
71
  q0, q1 = cirq.NamedQubit('q0'), cirq.NamedQubit('q1')
72
72
  op0 = gate(q0, q1)
73
73
  op1 = gate(q1, q0)
@@ -78,7 +78,7 @@ def test_interchangeable_qubits(gate):
78
78
  assert same == same_check
79
79
 
80
80
 
81
- def test_exponent():
81
+ def test_exponent() -> None:
82
82
  cnot = cirq.PauliInteractionGate(cirq.Z, False, cirq.X, False)
83
83
  np.testing.assert_almost_equal(
84
84
  cirq.unitary(cnot**0.5),
@@ -93,18 +93,18 @@ def test_exponent():
93
93
  )
94
94
 
95
95
 
96
- def test_repr():
96
+ def test_repr() -> None:
97
97
  cnot = cirq.PauliInteractionGate(cirq.Z, False, cirq.X, False)
98
98
  cirq.testing.assert_equivalent_repr(cnot)
99
99
 
100
100
 
101
- def test_decomposes_despite_symbol():
101
+ def test_decomposes_despite_symbol() -> None:
102
102
  q0, q1 = cirq.NamedQubit('q0'), cirq.NamedQubit('q1')
103
103
  gate = cirq.PauliInteractionGate(cirq.Z, False, cirq.X, False, exponent=sympy.Symbol('x'))
104
104
  assert cirq.decompose_once_with_qubits(gate, [q0, q1])
105
105
 
106
106
 
107
- def test_text_diagrams():
107
+ def test_text_diagrams() -> None:
108
108
  q0, q1 = cirq.NamedQubit('q0'), cirq.NamedQubit('q1')
109
109
  circuit = cirq.Circuit(
110
110
  cirq.PauliInteractionGate(cirq.X, False, cirq.X, False)(q0, q1),
@@ -22,12 +22,12 @@ import cirq.testing
22
22
  q0, q1, q2, q3 = cirq.LineQubit.range(4)
23
23
 
24
24
 
25
- def test_raises_for_non_commuting_paulis():
25
+ def test_raises_for_non_commuting_paulis() -> None:
26
26
  with pytest.raises(ValueError, match='commuting'):
27
27
  cirq.PauliSumExponential(cirq.X(q0) + cirq.Z(q0), np.pi / 2)
28
28
 
29
29
 
30
- def test_raises_for_non_hermitian_pauli():
30
+ def test_raises_for_non_hermitian_pauli() -> None:
31
31
  with pytest.raises(ValueError, match='hermitian'):
32
32
  cirq.PauliSumExponential(cirq.X(q0) + 1j * cirq.Z(q1), np.pi / 2)
33
33
 
@@ -46,7 +46,7 @@ def test_raises_for_non_hermitian_pauli():
46
46
  ),
47
47
  ),
48
48
  )
49
- def test_pauli_sum_exponential_qubits(psum_exp, expected_qubits):
49
+ def test_pauli_sum_exponential_qubits(psum_exp, expected_qubits) -> None:
50
50
  assert psum_exp.qubits == expected_qubits
51
51
 
52
52
 
@@ -67,7 +67,7 @@ def test_pauli_sum_exponential_qubits(psum_exp, expected_qubits):
67
67
  ),
68
68
  ),
69
69
  )
70
- def test_pauli_sum_exponential_with_qubits(psum_exp, expected_psum_exp):
70
+ def test_pauli_sum_exponential_with_qubits(psum_exp, expected_psum_exp) -> None:
71
71
  assert psum_exp.with_qubits(*expected_psum_exp.qubits) == expected_psum_exp
72
72
 
73
73
 
@@ -79,7 +79,7 @@ def test_pauli_sum_exponential_with_qubits(psum_exp, expected_psum_exp):
79
79
  (cirq.X(q0) * cirq.Y(q1) + cirq.Y(q1) * cirq.Z(q3), np.pi),
80
80
  ),
81
81
  )
82
- def test_with_parameters_resolved_by(psum, exp):
82
+ def test_with_parameters_resolved_by(psum, exp) -> None:
83
83
  psum_exp = cirq.PauliSumExponential(psum, sympy.Symbol("theta"))
84
84
  resolver = cirq.ParamResolver({"theta": exp})
85
85
  actual = cirq.resolve_parameters(psum_exp, resolver)
@@ -87,7 +87,7 @@ def test_with_parameters_resolved_by(psum, exp):
87
87
  assert actual == expected
88
88
 
89
89
 
90
- def test_pauli_sum_exponential_parameterized_matrix_raises():
90
+ def test_pauli_sum_exponential_parameterized_matrix_raises() -> None:
91
91
  with pytest.raises(ValueError, match='parameterized'):
92
92
  cirq.PauliSumExponential(cirq.X(q0) + cirq.Z(q1), sympy.Symbol("theta")).matrix()
93
93
 
@@ -102,7 +102,7 @@ def test_pauli_sum_exponential_parameterized_matrix_raises():
102
102
  ),
103
103
  ),
104
104
  )
105
- def test_pauli_sum_exponential_has_correct_unitary(psum_exp, expected_unitary):
105
+ def test_pauli_sum_exponential_has_correct_unitary(psum_exp, expected_unitary) -> None:
106
106
  assert cirq.has_unitary(psum_exp)
107
107
  assert np.allclose(cirq.unitary(psum_exp), expected_unitary)
108
108
 
@@ -127,7 +127,7 @@ def test_pauli_sum_exponential_has_correct_unitary(psum_exp, expected_unitary):
127
127
  ),
128
128
  ),
129
129
  )
130
- def test_pauli_sum_exponential_pow(psum_exp, power, expected_psum):
130
+ def test_pauli_sum_exponential_pow(psum_exp, power, expected_psum) -> None:
131
131
  assert psum_exp**power == expected_psum
132
132
 
133
133
 
@@ -138,7 +138,7 @@ def test_pauli_sum_exponential_pow(psum_exp, power, expected_psum):
138
138
  (cirq.PauliSumExponential(2j * cirq.X(q0) + 3j * cirq.Z(q1), np.pi / 2)),
139
139
  ),
140
140
  )
141
- def test_pauli_sum_exponential_repr(psum_exp):
141
+ def test_pauli_sum_exponential_repr(psum_exp) -> None:
142
142
  cirq.testing.assert_equivalent_repr(psum_exp)
143
143
 
144
144
 
@@ -156,5 +156,5 @@ def test_pauli_sum_exponential_repr(psum_exp):
156
156
  ),
157
157
  ),
158
158
  )
159
- def test_pauli_sum_exponential_formatting(psum_exp, expected_str):
159
+ def test_pauli_sum_exponential_formatting(psum_exp, expected_str) -> None:
160
160
  assert str(psum_exp) == expected_str
@@ -19,7 +19,7 @@ import cirq
19
19
  from cirq.ops import QubitPermutationGate
20
20
 
21
21
 
22
- def test_permutation_gate_equality():
22
+ def test_permutation_gate_equality() -> None:
23
23
  eq = cirq.testing.EqualsTester()
24
24
  eq.make_equality_group(
25
25
  lambda: QubitPermutationGate([0, 1]), lambda: QubitPermutationGate((0, 1))
@@ -27,7 +27,7 @@ def test_permutation_gate_equality():
27
27
  eq.add_equality_group(QubitPermutationGate([1, 0]), QubitPermutationGate((1, 0)))
28
28
 
29
29
 
30
- def test_permutation_gate_repr():
30
+ def test_permutation_gate_repr() -> None:
31
31
  cirq.testing.assert_equivalent_repr(QubitPermutationGate([0, 1]))
32
32
 
33
33
 
@@ -35,26 +35,26 @@ rs = np.random.RandomState(seed=1234)
35
35
 
36
36
 
37
37
  @pytest.mark.parametrize('permutation', [rs.permutation(i) for i in range(3, 7)])
38
- def test_permutation_gate_consistent_protocols(permutation):
38
+ def test_permutation_gate_consistent_protocols(permutation) -> None:
39
39
  gate = QubitPermutationGate(list(permutation))
40
40
  cirq.testing.assert_implements_consistent_protocols(gate)
41
41
 
42
42
 
43
- def test_permutation_gate_invalid_indices():
43
+ def test_permutation_gate_invalid_indices() -> None:
44
44
  with pytest.raises(ValueError, match="Invalid indices"):
45
45
  QubitPermutationGate([1, 0, 2, 4])
46
46
  with pytest.raises(ValueError, match="Invalid indices"):
47
47
  QubitPermutationGate([-1])
48
48
 
49
49
 
50
- def test_permutation_gate_invalid_permutation():
50
+ def test_permutation_gate_invalid_permutation() -> None:
51
51
  with pytest.raises(ValueError, match="Invalid permutation"):
52
52
  QubitPermutationGate([1, 1])
53
53
  with pytest.raises(ValueError, match="Invalid permutation"):
54
54
  QubitPermutationGate([])
55
55
 
56
56
 
57
- def test_permutation_gate_diagram():
57
+ def test_permutation_gate_diagram() -> None:
58
58
  q = cirq.LineQubit.range(6)
59
59
  cirq.testing.assert_has_diagram(
60
60
  cirq.Circuit(cirq.X(q[0]), cirq.X(q[5]), QubitPermutationGate([3, 2, 1, 0]).on(*q[1:5])),
@@ -74,7 +74,7 @@ def test_permutation_gate_diagram():
74
74
  )
75
75
 
76
76
 
77
- def test_permutation_gate_json_dict():
77
+ def test_permutation_gate_json_dict() -> None:
78
78
  assert cirq.QubitPermutationGate([0, 1, 2])._json_dict_() == {'permutation': (0, 1, 2)}
79
79
 
80
80
 
@@ -96,7 +96,7 @@ def test_permutation_gate_json_dict():
96
96
  ],
97
97
  ],
98
98
  )
99
- def test_permutation_gate_maps(maps, permutation):
99
+ def test_permutation_gate_maps(maps, permutation) -> None:
100
100
  qs = cirq.LineQubit.range(len(permutation))
101
101
  permutationOp = cirq.QubitPermutationGate(permutation).on(*qs)
102
102
  circuit = cirq.Circuit(permutationOp)