cirq-core 1.6.0.dev20250509215532__py3-none-any.whl → 1.6.0.dev20250514001158__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.dev20250514001158.dist-info}/METADATA +2 -1
  164. {cirq_core-1.6.0.dev20250509215532.dist-info → cirq_core-1.6.0.dev20250514001158.dist-info}/RECORD +167 -167
  165. {cirq_core-1.6.0.dev20250509215532.dist-info → cirq_core-1.6.0.dev20250514001158.dist-info}/WHEEL +0 -0
  166. {cirq_core-1.6.0.dev20250509215532.dist-info → cirq_core-1.6.0.dev20250514001158.dist-info}/licenses/LICENSE +0 -0
  167. {cirq_core-1.6.0.dev20250509215532.dist-info → cirq_core-1.6.0.dev20250514001158.dist-info}/top_level.txt +0 -0
@@ -56,7 +56,7 @@ def assert_mixtures_equal(actual, expected):
56
56
  np.testing.assert_almost_equal(a[1], e[1])
57
57
 
58
58
 
59
- def test_asymmetric_depolarizing_channel():
59
+ def test_asymmetric_depolarizing_channel() -> None:
60
60
  d = cirq.asymmetric_depolarize(0.1, 0.2, 0.3)
61
61
  np.testing.assert_almost_equal(
62
62
  cirq.kraus(d),
@@ -68,17 +68,17 @@ def test_asymmetric_depolarizing_channel():
68
68
  assert cirq.AsymmetricDepolarizingChannel(p_x=0, p_y=0.1, p_z=0).num_qubits() == 1
69
69
 
70
70
 
71
- def test_asymmetric_depolarizing_mixture():
71
+ def test_asymmetric_depolarizing_mixture() -> None:
72
72
  d = cirq.asymmetric_depolarize(0.1, 0.2, 0.3)
73
73
  assert_mixtures_equal(cirq.mixture(d), ((0.4, np.eye(2)), (0.1, X), (0.2, Y), (0.3, Z)))
74
74
  assert cirq.has_mixture(d)
75
75
 
76
76
 
77
- def test_asymmetric_depolarizing_channel_repr():
77
+ def test_asymmetric_depolarizing_channel_repr() -> None:
78
78
  cirq.testing.assert_equivalent_repr(cirq.AsymmetricDepolarizingChannel(0.1, 0.2, 0.3))
79
79
 
80
80
 
81
- def test_asymmetric_depolarizing_channel_str():
81
+ def test_asymmetric_depolarizing_channel_str() -> None:
82
82
  assert (
83
83
  str(cirq.asymmetric_depolarize(0.1, 0.2, 0.3))
84
84
  == "asymmetric_depolarize(error_probabilities={'I': 0.3999999999999999, "
@@ -86,7 +86,7 @@ def test_asymmetric_depolarizing_channel_str():
86
86
  )
87
87
 
88
88
 
89
- def test_asymmetric_depolarizing_channel_eq():
89
+ def test_asymmetric_depolarizing_channel_eq() -> None:
90
90
  a = cirq.asymmetric_depolarize(0.0099999, 0.01)
91
91
  b = cirq.asymmetric_depolarize(0.01, 0.0099999)
92
92
  c = cirq.asymmetric_depolarize(0.0, 0.0, 0.0)
@@ -109,7 +109,7 @@ def test_asymmetric_depolarizing_channel_eq():
109
109
  @pytest.mark.parametrize(
110
110
  'p_x,p_y,p_z', ((-0.1, 0.0, 0.0), (0.0, -0.1, 0.0), (0.0, 0.0, -0.1), (0.1, -0.1, 0.1))
111
111
  )
112
- def test_asymmetric_depolarizing_channel_negative_probability(p_x, p_y, p_z):
112
+ def test_asymmetric_depolarizing_channel_negative_probability(p_x, p_y, p_z) -> None:
113
113
  with pytest.raises(ValueError, match='was less than 0'):
114
114
  cirq.asymmetric_depolarize(p_x, p_y, p_z)
115
115
 
@@ -117,12 +117,12 @@ def test_asymmetric_depolarizing_channel_negative_probability(p_x, p_y, p_z):
117
117
  @pytest.mark.parametrize(
118
118
  'p_x,p_y,p_z', ((1.1, 0.0, 0.0), (0.0, 1.1, 0.0), (0.0, 0.0, 1.1), (0.1, 0.9, 0.1))
119
119
  )
120
- def test_asymmetric_depolarizing_channel_bigly_probability(p_x, p_y, p_z):
120
+ def test_asymmetric_depolarizing_channel_bigly_probability(p_x, p_y, p_z) -> None:
121
121
  with pytest.raises(ValueError, match='was greater than 1'):
122
122
  cirq.asymmetric_depolarize(p_x, p_y, p_z)
123
123
 
124
124
 
125
- def test_asymmetric_depolarizing_channel_text_diagram():
125
+ def test_asymmetric_depolarizing_channel_text_diagram() -> None:
126
126
  a = cirq.asymmetric_depolarize(1 / 9, 2 / 9, 3 / 9)
127
127
  assert cirq.circuit_diagram_info(a, args=no_precision) == cirq.CircuitDiagramInfo(
128
128
  wire_symbols=('A(0.1111111111111111,0.2222222222222222,' + '0.3333333333333333)',)
@@ -135,7 +135,7 @@ def test_asymmetric_depolarizing_channel_text_diagram():
135
135
  )
136
136
 
137
137
 
138
- def test_depolarizing_channel():
138
+ def test_depolarizing_channel() -> None:
139
139
  d = cirq.depolarize(0.3)
140
140
  np.testing.assert_almost_equal(
141
141
  cirq.kraus(d),
@@ -145,7 +145,7 @@ def test_depolarizing_channel():
145
145
  cirq.testing.assert_consistent_mixture(d)
146
146
 
147
147
 
148
- def test_depolarizing_channel_two_qubits():
148
+ def test_depolarizing_channel_two_qubits() -> None:
149
149
  d = cirq.depolarize(0.15, n_qubits=2)
150
150
  np.testing.assert_almost_equal(
151
151
  cirq.kraus(d),
@@ -182,13 +182,13 @@ def test_depolarizing_channel_two_qubits():
182
182
  )
183
183
 
184
184
 
185
- def test_depolarizing_mixture():
185
+ def test_depolarizing_mixture() -> None:
186
186
  d = cirq.depolarize(0.3)
187
187
  assert_mixtures_equal(cirq.mixture(d), ((0.7, np.eye(2)), (0.1, X), (0.1, Y), (0.1, Z)))
188
188
  assert cirq.has_mixture(d)
189
189
 
190
190
 
191
- def test_depolarizing_mixture_two_qubits():
191
+ def test_depolarizing_mixture_two_qubits() -> None:
192
192
  d = cirq.depolarize(0.15, n_qubits=2)
193
193
  assert_mixtures_equal(
194
194
  cirq.mixture(d),
@@ -214,23 +214,23 @@ def test_depolarizing_mixture_two_qubits():
214
214
  assert cirq.has_mixture(d)
215
215
 
216
216
 
217
- def test_depolarizing_channel_repr():
217
+ def test_depolarizing_channel_repr() -> None:
218
218
  cirq.testing.assert_equivalent_repr(cirq.DepolarizingChannel(0.3))
219
219
 
220
220
 
221
- def test_depolarizing_channel_repr_two_qubits():
221
+ def test_depolarizing_channel_repr_two_qubits() -> None:
222
222
  cirq.testing.assert_equivalent_repr(cirq.DepolarizingChannel(0.3, n_qubits=2))
223
223
 
224
224
 
225
- def test_depolarizing_channel_str():
225
+ def test_depolarizing_channel_str() -> None:
226
226
  assert str(cirq.depolarize(0.3)) == 'depolarize(p=0.3)'
227
227
 
228
228
 
229
- def test_depolarizing_channel_str_two_qubits():
229
+ def test_depolarizing_channel_str_two_qubits() -> None:
230
230
  assert str(cirq.depolarize(0.3, n_qubits=2)) == 'depolarize(p=0.3,n_qubits=2)'
231
231
 
232
232
 
233
- def test_deprecated_on_each_for_depolarizing_channel_one_qubit():
233
+ def test_deprecated_on_each_for_depolarizing_channel_one_qubit() -> None:
234
234
  q0 = cirq.LineQubit.range(1)
235
235
  op = cirq.DepolarizingChannel(p=0.1, n_qubits=1)
236
236
 
@@ -240,7 +240,7 @@ def test_deprecated_on_each_for_depolarizing_channel_one_qubit():
240
240
  op.on_each('bogus object')
241
241
 
242
242
 
243
- def test_deprecated_on_each_for_depolarizing_channel_two_qubits():
243
+ def test_deprecated_on_each_for_depolarizing_channel_two_qubits() -> None:
244
244
  q0, q1, q2, q3, q4, q5 = cirq.LineQubit.range(6)
245
245
  op = cirq.DepolarizingChannel(p=0.1, n_qubits=2)
246
246
 
@@ -259,19 +259,19 @@ def test_deprecated_on_each_for_depolarizing_channel_two_qubits():
259
259
  op.on_each([(False, None)])
260
260
 
261
261
 
262
- def test_depolarizing_channel_apply_two_qubits():
262
+ def test_depolarizing_channel_apply_two_qubits() -> None:
263
263
  q0, q1 = cirq.LineQubit.range(2)
264
264
  op = cirq.DepolarizingChannel(p=0.1, n_qubits=2)
265
265
  op(q0, q1)
266
266
 
267
267
 
268
- def test_asymmetric_depolarizing_channel_apply_two_qubits():
268
+ def test_asymmetric_depolarizing_channel_apply_two_qubits() -> None:
269
269
  q0, q1 = cirq.LineQubit.range(2)
270
270
  op = cirq.AsymmetricDepolarizingChannel(error_probabilities={'XX': 0.1})
271
271
  op(q0, q1)
272
272
 
273
273
 
274
- def test_depolarizing_channel_eq():
274
+ def test_depolarizing_channel_eq() -> None:
275
275
  a = cirq.depolarize(p=0.0099999)
276
276
  b = cirq.depolarize(p=0.01)
277
277
  c = cirq.depolarize(0.0)
@@ -288,14 +288,14 @@ def test_depolarizing_channel_eq():
288
288
  et.add_equality_group(cirq.depolarize(1.0, n_qubits=2))
289
289
 
290
290
 
291
- def test_depolarizing_channel_invalid_probability():
291
+ def test_depolarizing_channel_invalid_probability() -> None:
292
292
  with pytest.raises(ValueError, match=re.escape('p(I) was greater than 1.')):
293
293
  cirq.depolarize(-0.1)
294
294
  with pytest.raises(ValueError, match=re.escape('p(I) was less than 0.')):
295
295
  cirq.depolarize(1.1)
296
296
 
297
297
 
298
- def test_depolarizing_channel_text_diagram():
298
+ def test_depolarizing_channel_text_diagram() -> None:
299
299
  d = cirq.depolarize(0.1234567)
300
300
  assert cirq.circuit_diagram_info(d, args=round_to_6_prec) == cirq.CircuitDiagramInfo(
301
301
  wire_symbols=('D(0.123457)',)
@@ -308,7 +308,7 @@ def test_depolarizing_channel_text_diagram():
308
308
  )
309
309
 
310
310
 
311
- def test_depolarizing_channel_text_diagram_two_qubits():
311
+ def test_depolarizing_channel_text_diagram_two_qubits() -> None:
312
312
  d = cirq.depolarize(0.1234567, n_qubits=2)
313
313
  assert cirq.circuit_diagram_info(d, args=round_to_6_prec) == cirq.CircuitDiagramInfo(
314
314
  wire_symbols=('D(0.123457)', '#2')
@@ -321,7 +321,7 @@ def test_depolarizing_channel_text_diagram_two_qubits():
321
321
  )
322
322
 
323
323
 
324
- def test_generalized_amplitude_damping_channel():
324
+ def test_generalized_amplitude_damping_channel() -> None:
325
325
  d = cirq.generalized_amplitude_damp(0.1, 0.3)
326
326
  np.testing.assert_almost_equal(
327
327
  cirq.kraus(d),
@@ -336,18 +336,18 @@ def test_generalized_amplitude_damping_channel():
336
336
  assert not cirq.has_mixture(d)
337
337
 
338
338
 
339
- def test_generalized_amplitude_damping_repr():
339
+ def test_generalized_amplitude_damping_repr() -> None:
340
340
  cirq.testing.assert_equivalent_repr(cirq.GeneralizedAmplitudeDampingChannel(0.1, 0.3))
341
341
 
342
342
 
343
- def test_generalized_amplitude_damping_str():
343
+ def test_generalized_amplitude_damping_str() -> None:
344
344
  assert (
345
345
  str(cirq.generalized_amplitude_damp(0.1, 0.3))
346
346
  == 'generalized_amplitude_damp(p=0.1,gamma=0.3)'
347
347
  )
348
348
 
349
349
 
350
- def test_generalized_amplitude_damping_channel_eq():
350
+ def test_generalized_amplitude_damping_channel_eq() -> None:
351
351
  a = cirq.generalized_amplitude_damp(0.0099999, 0.01)
352
352
  b = cirq.generalized_amplitude_damp(0.01, 0.0099999)
353
353
 
@@ -364,18 +364,18 @@ def test_generalized_amplitude_damping_channel_eq():
364
364
 
365
365
 
366
366
  @pytest.mark.parametrize('p, gamma', ((-0.1, 0.0), (0.0, -0.1), (0.1, -0.1), (-0.1, 0.1)))
367
- def test_generalized_amplitude_damping_channel_negative_probability(p, gamma):
367
+ def test_generalized_amplitude_damping_channel_negative_probability(p, gamma) -> None:
368
368
  with pytest.raises(ValueError, match='was less than 0'):
369
369
  cirq.generalized_amplitude_damp(p, gamma)
370
370
 
371
371
 
372
372
  @pytest.mark.parametrize('p,gamma', ((1.1, 0.0), (0.0, 1.1), (1.1, 1.1)))
373
- def test_generalized_amplitude_damping_channel_bigly_probability(p, gamma):
373
+ def test_generalized_amplitude_damping_channel_bigly_probability(p, gamma) -> None:
374
374
  with pytest.raises(ValueError, match='was greater than 1'):
375
375
  cirq.generalized_amplitude_damp(p, gamma)
376
376
 
377
377
 
378
- def test_generalized_amplitude_damping_channel_text_diagram():
378
+ def test_generalized_amplitude_damping_channel_text_diagram() -> None:
379
379
  a = cirq.generalized_amplitude_damp(0.1, 0.39558391)
380
380
  assert cirq.circuit_diagram_info(a, args=round_to_6_prec) == cirq.CircuitDiagramInfo(
381
381
  wire_symbols=('GAD(0.1,0.395584)',)
@@ -388,7 +388,7 @@ def test_generalized_amplitude_damping_channel_text_diagram():
388
388
  )
389
389
 
390
390
 
391
- def test_amplitude_damping_channel():
391
+ def test_amplitude_damping_channel() -> None:
392
392
  d = cirq.amplitude_damp(0.3)
393
393
  np.testing.assert_almost_equal(
394
394
  cirq.kraus(d),
@@ -401,15 +401,15 @@ def test_amplitude_damping_channel():
401
401
  assert not cirq.has_mixture(d)
402
402
 
403
403
 
404
- def test_amplitude_damping_channel_repr():
404
+ def test_amplitude_damping_channel_repr() -> None:
405
405
  cirq.testing.assert_equivalent_repr(cirq.AmplitudeDampingChannel(0.3))
406
406
 
407
407
 
408
- def test_amplitude_damping_channel_str():
408
+ def test_amplitude_damping_channel_str() -> None:
409
409
  assert str(cirq.amplitude_damp(0.3)) == 'amplitude_damp(gamma=0.3)'
410
410
 
411
411
 
412
- def test_amplitude_damping_channel_eq():
412
+ def test_amplitude_damping_channel_eq() -> None:
413
413
  a = cirq.amplitude_damp(0.0099999)
414
414
  b = cirq.amplitude_damp(0.01)
415
415
  c = cirq.amplitude_damp(0.0)
@@ -425,14 +425,14 @@ def test_amplitude_damping_channel_eq():
425
425
  et.add_equality_group(cirq.amplitude_damp(0.8))
426
426
 
427
427
 
428
- def test_amplitude_damping_channel_invalid_probability():
428
+ def test_amplitude_damping_channel_invalid_probability() -> None:
429
429
  with pytest.raises(ValueError, match='was less than 0'):
430
430
  cirq.amplitude_damp(-0.1)
431
431
  with pytest.raises(ValueError, match='was greater than 1'):
432
432
  cirq.amplitude_damp(1.1)
433
433
 
434
434
 
435
- def test_amplitude_damping_channel_text_diagram():
435
+ def test_amplitude_damping_channel_text_diagram() -> None:
436
436
  ad = cirq.amplitude_damp(0.38059322)
437
437
  assert cirq.circuit_diagram_info(ad, args=round_to_6_prec) == cirq.CircuitDiagramInfo(
438
438
  wire_symbols=('AD(0.380593)',)
@@ -445,7 +445,7 @@ def test_amplitude_damping_channel_text_diagram():
445
445
  )
446
446
 
447
447
 
448
- def test_reset_channel():
448
+ def test_reset_channel() -> None:
449
449
  r = cirq.reset(cirq.LineQubit(0))
450
450
  np.testing.assert_almost_equal(
451
451
  cirq.kraus(r), (np.array([[1.0, 0.0], [0.0, 0]]), np.array([[0.0, 1.0], [0.0, 0.0]]))
@@ -470,22 +470,22 @@ def test_reset_channel():
470
470
  assert cirq.qid_shape(r) == (3,)
471
471
 
472
472
 
473
- def test_reset_channel_equality():
473
+ def test_reset_channel_equality() -> None:
474
474
  assert cirq.reset(cirq.LineQubit(0)).gate == cirq.ResetChannel()
475
475
  assert cirq.reset(cirq.LineQid(0, 3)).gate == cirq.ResetChannel(3)
476
476
 
477
477
 
478
- def test_reset_channel_repr():
478
+ def test_reset_channel_repr() -> None:
479
479
  cirq.testing.assert_equivalent_repr(cirq.ResetChannel())
480
480
  cirq.testing.assert_equivalent_repr(cirq.ResetChannel(3))
481
481
 
482
482
 
483
- def test_reset_channel_str():
483
+ def test_reset_channel_str() -> None:
484
484
  assert str(cirq.ResetChannel()) == 'reset'
485
485
  assert str(cirq.ResetChannel(3)) == 'reset'
486
486
 
487
487
 
488
- def test_reset_channel_text_diagram():
488
+ def test_reset_channel_text_diagram() -> None:
489
489
  assert cirq.circuit_diagram_info(cirq.ResetChannel()) == cirq.CircuitDiagramInfo(
490
490
  wire_symbols=('R',)
491
491
  )
@@ -494,7 +494,7 @@ def test_reset_channel_text_diagram():
494
494
  )
495
495
 
496
496
 
497
- def test_reset_act_on():
497
+ def test_reset_act_on() -> None:
498
498
  with pytest.raises(TypeError, match="Failed to act"):
499
499
  cirq.act_on(cirq.ResetChannel(), ExampleSimulationState(), qubits=())
500
500
 
@@ -523,7 +523,7 @@ def test_reset_act_on():
523
523
  )
524
524
 
525
525
 
526
- def test_reset_each():
526
+ def test_reset_each() -> None:
527
527
  qubits = cirq.LineQubit.range(8)
528
528
  for n in range(len(qubits) + 1):
529
529
  ops = cirq.reset_each(*qubits[:n])
@@ -533,14 +533,14 @@ def test_reset_each():
533
533
  assert op.qubits == (qubits[i],)
534
534
 
535
535
 
536
- def test_reset_consistency():
536
+ def test_reset_consistency() -> None:
537
537
  two_d_chan = cirq.ResetChannel()
538
538
  cirq.testing.assert_has_consistent_apply_channel(two_d_chan)
539
539
  three_d_chan = cirq.ResetChannel(dimension=3)
540
540
  cirq.testing.assert_has_consistent_apply_channel(three_d_chan)
541
541
 
542
542
 
543
- def test_phase_damping_channel():
543
+ def test_phase_damping_channel() -> None:
544
544
  d = cirq.phase_damp(0.3)
545
545
  np.testing.assert_almost_equal(
546
546
  cirq.kraus(d),
@@ -553,15 +553,15 @@ def test_phase_damping_channel():
553
553
  assert not cirq.has_mixture(d)
554
554
 
555
555
 
556
- def test_phase_damping_channel_repr():
556
+ def test_phase_damping_channel_repr() -> None:
557
557
  cirq.testing.assert_equivalent_repr(cirq.PhaseDampingChannel(0.3))
558
558
 
559
559
 
560
- def test_phase_damping_channel_str():
560
+ def test_phase_damping_channel_str() -> None:
561
561
  assert str(cirq.phase_damp(0.3)) == 'phase_damp(gamma=0.3)'
562
562
 
563
563
 
564
- def test_phase_damping_channel_eq():
564
+ def test_phase_damping_channel_eq() -> None:
565
565
  a = cirq.phase_damp(0.0099999)
566
566
  b = cirq.phase_damp(0.01)
567
567
  c = cirq.phase_damp(0.0)
@@ -577,14 +577,14 @@ def test_phase_damping_channel_eq():
577
577
  et.add_equality_group(cirq.phase_damp(0.8))
578
578
 
579
579
 
580
- def test_phase_damping_channel_invalid_probability():
580
+ def test_phase_damping_channel_invalid_probability() -> None:
581
581
  with pytest.raises(ValueError, match='was less than 0'):
582
582
  cirq.phase_damp(-0.1)
583
583
  with pytest.raises(ValueError, match='was greater than 1'):
584
584
  cirq.phase_damp(1.1)
585
585
 
586
586
 
587
- def test_phase_damping_channel_text_diagram():
587
+ def test_phase_damping_channel_text_diagram() -> None:
588
588
  pd = cirq.phase_damp(0.1000009)
589
589
  assert cirq.circuit_diagram_info(pd, args=round_to_6_prec) == cirq.CircuitDiagramInfo(
590
590
  wire_symbols=('PD(0.100001)',)
@@ -597,7 +597,7 @@ def test_phase_damping_channel_text_diagram():
597
597
  )
598
598
 
599
599
 
600
- def test_phase_damp_consistency():
600
+ def test_phase_damp_consistency() -> None:
601
601
  full_damp = cirq.PhaseDampingChannel(gamma=1)
602
602
  cirq.testing.assert_has_consistent_apply_channel(full_damp)
603
603
  partial_damp = cirq.PhaseDampingChannel(gamma=0.5)
@@ -606,7 +606,7 @@ def test_phase_damp_consistency():
606
606
  cirq.testing.assert_has_consistent_apply_channel(no_damp)
607
607
 
608
608
 
609
- def test_phase_flip_channel():
609
+ def test_phase_flip_channel() -> None:
610
610
  d = cirq.phase_flip(0.3)
611
611
  np.testing.assert_almost_equal(
612
612
  cirq.kraus(d), (np.sqrt(1.0 - 0.3) * np.eye(2), np.sqrt(0.3) * Z)
@@ -615,28 +615,28 @@ def test_phase_flip_channel():
615
615
  cirq.testing.assert_consistent_mixture(d)
616
616
 
617
617
 
618
- def test_phase_flip_mixture():
618
+ def test_phase_flip_mixture() -> None:
619
619
  d = cirq.phase_flip(0.3)
620
620
  assert_mixtures_equal(cirq.mixture(d), ((0.7, np.eye(2)), (0.3, Z)))
621
621
  assert cirq.has_mixture(d)
622
622
 
623
623
 
624
- def test_phase_flip_overload():
624
+ def test_phase_flip_overload() -> None:
625
625
  d = cirq.phase_flip()
626
626
  d2 = cirq.phase_flip(0.3)
627
627
  assert str(d) == 'Z'
628
628
  assert str(d2) == 'phase_flip(p=0.3)'
629
629
 
630
630
 
631
- def test_phase_flip_channel_repr():
631
+ def test_phase_flip_channel_repr() -> None:
632
632
  cirq.testing.assert_equivalent_repr(cirq.PhaseFlipChannel(0.3))
633
633
 
634
634
 
635
- def test_phase_flip_channel_str():
635
+ def test_phase_flip_channel_str() -> None:
636
636
  assert str(cirq.phase_flip(0.3)) == 'phase_flip(p=0.3)'
637
637
 
638
638
 
639
- def test_phase_flip_channel_eq():
639
+ def test_phase_flip_channel_eq() -> None:
640
640
  a = cirq.phase_flip(0.0099999)
641
641
  b = cirq.phase_flip(0.01)
642
642
  c = cirq.phase_flip(0.0)
@@ -652,14 +652,14 @@ def test_phase_flip_channel_eq():
652
652
  et.add_equality_group(cirq.phase_flip(0.8))
653
653
 
654
654
 
655
- def test_phase_flip_channel_invalid_probability():
655
+ def test_phase_flip_channel_invalid_probability() -> None:
656
656
  with pytest.raises(ValueError, match='was less than 0'):
657
657
  cirq.phase_flip(-0.1)
658
658
  with pytest.raises(ValueError, match='was greater than 1'):
659
659
  cirq.phase_flip(1.1)
660
660
 
661
661
 
662
- def test_phase_flip_channel_text_diagram():
662
+ def test_phase_flip_channel_text_diagram() -> None:
663
663
  pf = cirq.phase_flip(0.987654)
664
664
  assert cirq.circuit_diagram_info(pf, args=round_to_6_prec) == cirq.CircuitDiagramInfo(
665
665
  wire_symbols=('PF(0.987654)',)
@@ -672,7 +672,7 @@ def test_phase_flip_channel_text_diagram():
672
672
  )
673
673
 
674
674
 
675
- def test_bit_flip_channel():
675
+ def test_bit_flip_channel() -> None:
676
676
  d = cirq.bit_flip(0.3)
677
677
  np.testing.assert_almost_equal(
678
678
  cirq.kraus(d), (np.sqrt(1.0 - 0.3) * np.eye(2), np.sqrt(0.3) * X)
@@ -681,28 +681,28 @@ def test_bit_flip_channel():
681
681
  cirq.testing.assert_consistent_mixture(d)
682
682
 
683
683
 
684
- def test_bit_flip_mixture():
684
+ def test_bit_flip_mixture() -> None:
685
685
  d = cirq.bit_flip(0.3)
686
686
  assert_mixtures_equal(cirq.mixture(d), ((0.7, np.eye(2)), (0.3, X)))
687
687
  assert cirq.has_mixture(d)
688
688
 
689
689
 
690
- def test_bit_flip_overload():
690
+ def test_bit_flip_overload() -> None:
691
691
  d = cirq.bit_flip()
692
692
  d2 = cirq.bit_flip(0.3)
693
693
  assert str(d) == 'X'
694
694
  assert str(d2) == 'bit_flip(p=0.3)'
695
695
 
696
696
 
697
- def test_bit_flip_channel_repr():
697
+ def test_bit_flip_channel_repr() -> None:
698
698
  cirq.testing.assert_equivalent_repr(cirq.BitFlipChannel(0.3))
699
699
 
700
700
 
701
- def test_bit_flip_channel_str():
701
+ def test_bit_flip_channel_str() -> None:
702
702
  assert str(cirq.bit_flip(0.3)) == 'bit_flip(p=0.3)'
703
703
 
704
704
 
705
- def test_bit_flip_channel_eq():
705
+ def test_bit_flip_channel_eq() -> None:
706
706
  a = cirq.bit_flip(0.0099999)
707
707
  b = cirq.bit_flip(0.01)
708
708
  c = cirq.bit_flip(0.0)
@@ -718,14 +718,14 @@ def test_bit_flip_channel_eq():
718
718
  et.add_equality_group(cirq.bit_flip(0.8))
719
719
 
720
720
 
721
- def test_bit_flip_channel_invalid_probability():
721
+ def test_bit_flip_channel_invalid_probability() -> None:
722
722
  with pytest.raises(ValueError, match='was less than 0'):
723
723
  cirq.bit_flip(-0.1)
724
724
  with pytest.raises(ValueError, match='was greater than 1'):
725
725
  cirq.bit_flip(1.1)
726
726
 
727
727
 
728
- def test_bit_flip_channel_text_diagram():
728
+ def test_bit_flip_channel_text_diagram() -> None:
729
729
  bf = cirq.bit_flip(0.1234567)
730
730
  assert cirq.circuit_diagram_info(bf, args=round_to_6_prec) == cirq.CircuitDiagramInfo(
731
731
  wire_symbols=('BF(0.123457)',)
@@ -738,7 +738,7 @@ def test_bit_flip_channel_text_diagram():
738
738
  )
739
739
 
740
740
 
741
- def test_stabilizer_supports_depolarize():
741
+ def test_stabilizer_supports_depolarize() -> None:
742
742
  with pytest.raises(TypeError, match="act_on"):
743
743
  for _ in range(100):
744
744
  cirq.act_on(cirq.depolarize(3 / 4), ExampleSimulationState(), qubits=())
@@ -749,7 +749,7 @@ def test_stabilizer_supports_depolarize():
749
749
  assert 5 < m < 95
750
750
 
751
751
 
752
- def test_default_asymmetric_depolarizing_channel():
752
+ def test_default_asymmetric_depolarizing_channel() -> None:
753
753
  d = cirq.asymmetric_depolarize()
754
754
  assert d.p_i == 1.0
755
755
  assert d.p_x == 0.0
@@ -758,28 +758,28 @@ def test_default_asymmetric_depolarizing_channel():
758
758
  assert d.num_qubits() == 1
759
759
 
760
760
 
761
- def test_bad_error_probabilities_gate():
761
+ def test_bad_error_probabilities_gate() -> None:
762
762
  with pytest.raises(ValueError, match='AB is not made solely of I, X, Y, Z.'):
763
763
  cirq.asymmetric_depolarize(error_probabilities={'AB': 1.0})
764
764
  with pytest.raises(ValueError, match='Y must have 2 Pauli gates.'):
765
765
  cirq.asymmetric_depolarize(error_probabilities={'IX': 0.8, 'Y': 0.2})
766
766
 
767
767
 
768
- def test_bad_probs():
768
+ def test_bad_probs() -> None:
769
769
  with pytest.raises(ValueError, match=re.escape('p(X) was greater than 1.')):
770
770
  cirq.asymmetric_depolarize(error_probabilities={'X': 1.1, 'Y': -0.1})
771
771
  with pytest.raises(ValueError, match=re.escape('Probabilities do not add up to 1')):
772
772
  cirq.asymmetric_depolarize(error_probabilities={'X': 0.7, 'Y': 0.6})
773
773
 
774
774
 
775
- def test_missing_prob_mass():
775
+ def test_missing_prob_mass() -> None:
776
776
  with pytest.raises(ValueError, match='Probabilities do not add up to 1'):
777
777
  cirq.asymmetric_depolarize(error_probabilities={'X': 0.1, 'I': 0.2})
778
778
  d = cirq.asymmetric_depolarize(error_probabilities={'X': 0.1})
779
779
  np.testing.assert_almost_equal(d.error_probabilities['I'], 0.9)
780
780
 
781
781
 
782
- def test_multi_asymmetric_depolarizing_channel():
782
+ def test_multi_asymmetric_depolarizing_channel() -> None:
783
783
  d = cirq.asymmetric_depolarize(error_probabilities={'II': 0.8, 'XX': 0.2})
784
784
  np.testing.assert_almost_equal(
785
785
  cirq.kraus(d), (np.sqrt(0.8) * np.eye(4), np.sqrt(0.2) * np.kron(X, X))
@@ -798,20 +798,20 @@ def test_multi_asymmetric_depolarizing_channel():
798
798
  assert d.p_z == 0.0
799
799
 
800
800
 
801
- def test_multi_asymmetric_depolarizing_mixture():
801
+ def test_multi_asymmetric_depolarizing_mixture() -> None:
802
802
  d = cirq.asymmetric_depolarize(error_probabilities={'II': 0.8, 'XX': 0.2})
803
803
  assert_mixtures_equal(cirq.mixture(d), ((0.8, np.eye(4)), (0.2, np.kron(X, X))))
804
804
  assert cirq.has_mixture(d)
805
805
  np.testing.assert_equal(d._num_qubits_(), 2)
806
806
 
807
807
 
808
- def test_multi_asymmetric_depolarizing_channel_repr():
808
+ def test_multi_asymmetric_depolarizing_channel_repr() -> None:
809
809
  cirq.testing.assert_equivalent_repr(
810
810
  cirq.AsymmetricDepolarizingChannel(error_probabilities={'II': 0.8, 'XX': 0.2})
811
811
  )
812
812
 
813
813
 
814
- def test_multi_asymmetric_depolarizing_eq():
814
+ def test_multi_asymmetric_depolarizing_eq() -> None:
815
815
  a = cirq.asymmetric_depolarize(error_probabilities={'I': 0.8, 'X': 0.2})
816
816
  b = cirq.asymmetric_depolarize(error_probabilities={'II': 0.8, 'XX': 0.2})
817
817
 
@@ -845,13 +845,13 @@ def test_multi_asymmetric_depolarizing_eq():
845
845
  assert not cirq.approx_eq(a, cirq.X)
846
846
 
847
847
 
848
- def test_multi_asymmetric_depolarizing_channel_str():
848
+ def test_multi_asymmetric_depolarizing_channel_str() -> None:
849
849
  assert str(cirq.asymmetric_depolarize(error_probabilities={'II': 0.8, 'XX': 0.2})) == (
850
850
  "asymmetric_depolarize(error_probabilities={'II': 0.8, 'XX': 0.2})"
851
851
  )
852
852
 
853
853
 
854
- def test_multi_asymmetric_depolarizing_channel_text_diagram():
854
+ def test_multi_asymmetric_depolarizing_channel_text_diagram() -> None:
855
855
  a = cirq.asymmetric_depolarize(error_probabilities={'II': 2 / 3, 'XX': 1 / 3})
856
856
  assert cirq.circuit_diagram_info(a, args=no_precision) == cirq.CircuitDiagramInfo(
857
857
  wire_symbols=('A(II:0.6666666666666666, XX:0.3333333333333333)', '(1)')
@@ -867,5 +867,5 @@ def test_multi_asymmetric_depolarizing_channel_text_diagram():
867
867
  )
868
868
 
869
869
 
870
- def test_reset_stabilizer():
870
+ def test_reset_stabilizer() -> None:
871
871
  assert cirq.has_stabilizer_effect(cirq.reset(cirq.LineQubit(0)))