quantumlib / Cirq

A python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.19k stars 995 forks source link

cirq-core tests fail on Python 3.11 #6018

Closed dotlambda closed 11 months ago

dotlambda commented 1 year ago

Description of the issue

FAILED cirq/circuits/frozen_circuit_test.py::test_immutable - AssertionError: Regex pattern did not match.
FAILED cirq/devices/grid_qubit_test.py::test_immutable - AssertionError: Regex pattern did not match.
FAILED cirq/devices/line_qubit_test.py::test_immutable - AssertionError: Regex pattern did not match.
FAILED cirq/ops/gate_operation_test.py::test_immutable - AssertionError: Regex pattern did not match.
FAILED cirq/ops/gateset_test.py::test_gate_family_immutable - AssertionError: Regex pattern did not match.
FAILED cirq/value/classical_data_test.py::test_repr - AssertionError: eval(repr(value)) raised an exception.
``` ============================= test session starts ============================== platform linux -- Python 3.11.2, pytest-7.2.0, pluggy-1.0.0 rootdir: /build/source, configfile: pyproject.toml plugins: asyncio-0.20.3 asyncio: mode=Mode.STRICT collected 13075 items / 5 deselected / 13070 selected cirq/_compat_test.py .............................s................. [ 0%] cirq/_import_test.py . [ 0%] cirq/circuits/_block_diagram_drawer_test.py ...... [ 0%] cirq/circuits/_box_drawing_character_data_test.py . [ 0%] cirq/circuits/_bucket_priority_queue_test.py ......... [ 0%] cirq/circuits/circuit_operation_test.py ................................ [ 0%] ....................................... [ 1%] cirq/circuits/circuit_test.py .......................................... [ 1%] ........................................................................ [ 1%] ........................................................................ [ 2%] ........................................................................ [ 3%] ........................................................................ [ 3%] ........................................................................ [ 4%] ............................................. [ 4%] cirq/circuits/frozen_circuit_test.py ..F [ 4%] cirq/circuits/insert_strategy_test.py . [ 4%] cirq/circuits/moment_test.py ........................................... [ 4%] [ 4%] cirq/circuits/optimization_pass_test.py ..... [ 4%] cirq/circuits/qasm_output_test.py ................... [ 4%] cirq/circuits/text_diagram_drawer_test.py ........... [ 5%] cirq/devices/device_test.py .... [ 5%] cirq/devices/grid_device_metadata_test.py ........ [ 5%] cirq/devices/grid_qubit_test.py .......................F. [ 5%] cirq/devices/insertion_noise_model_test.py ..... [ 5%] cirq/devices/line_qubit_test.py ................F. [ 5%] cirq/devices/named_topologies_test.py ........................... [ 5%] cirq/devices/noise_model_test.py ............ [ 5%] cirq/devices/noise_properties_test.py . [ 5%] cirq/devices/noise_utils_test.py ................... [ 5%] cirq/devices/superconducting_qubits_noise_properties_test.py .......... [ 6%] cirq/devices/thermal_noise_model_test.py ............. [ 6%] cirq/devices/unconstrained_device_test.py .. [ 6%] cirq/experiments/fidelity_estimation_test.py ................ [ 6%] cirq/experiments/grid_parallel_two_qubit_xeb_test.py . [ 6%] cirq/experiments/n_qubit_tomography_test.py ........... [ 6%] cirq/experiments/purity_estimation_test.py . [ 6%] cirq/experiments/qubit_characterizations_test.py ...... [ 6%] cirq/experiments/random_quantum_circuit_generation_test.py ............. [ 6%] .... [ 6%] cirq/experiments/readout_confusion_matrix_test.py ........ [ 6%] cirq/experiments/single_qubit_readout_calibration_test.py ............ [ 6%] cirq/experiments/t1_decay_experiment_test.py ................ [ 6%] cirq/experiments/t2_decay_experiment_test.py .................... [ 7%] cirq/experiments/xeb_fitting_test.py ........... [ 7%] cirq/experiments/xeb_sampling_test.py ...... [ 7%] cirq/experiments/xeb_simulation_test.py .... [ 7%] cirq/interop/quirk/url_to_circuit_test.py .................. [ 7%] cirq/interop/quirk/cells/arithmetic_cells_test.py .............. [ 7%] cirq/interop/quirk/cells/cell_test.py .... [ 7%] cirq/interop/quirk/cells/composite_cell_test.py .. [ 7%] cirq/interop/quirk/cells/control_cells_test.py ..... [ 7%] cirq/interop/quirk/cells/frequency_space_cells_test.py . [ 7%] cirq/interop/quirk/cells/ignored_cells_test.py . [ 7%] cirq/interop/quirk/cells/input_cells_test.py ..... [ 7%] cirq/interop/quirk/cells/input_rotation_cells_test.py ....... [ 7%] cirq/interop/quirk/cells/measurement_cells_test.py . [ 7%] cirq/interop/quirk/cells/parse_test.py ........ [ 7%] cirq/interop/quirk/cells/qubit_permutation_cells_test.py ....... [ 7%] cirq/interop/quirk/cells/scalar_cells_test.py . [ 7%] cirq/interop/quirk/cells/single_qubit_rotation_cells_test.py ... [ 7%] cirq/interop/quirk/cells/swap_cell_test.py .... [ 7%] cirq/interop/quirk/cells/testing_test.py ...... [ 7%] cirq/interop/quirk/cells/unsupported_cells_test.py .. [ 7%] cirq/linalg/combinators_test.py ....... [ 7%] cirq/linalg/decompositions_test.py ..................................... [ 8%] ........................................................................ [ 8%] ............................... [ 8%] cirq/linalg/diagonalize_test.py ........................................ [ 9%] ........................................................................ [ 9%] ........................................................................ [ 10%] ........................................................................ [ 10%] ................................................................. [ 11%] cirq/linalg/operator_spaces_test.py .................................... [ 11%] ........................................................................ [ 12%] ........................................................................ [ 12%] ........................................................................ [ 13%] ........................................................................ [ 13%] ........................................................................ [ 14%] .................... [ 14%] cirq/linalg/predicates_test.py ...................... [ 14%] cirq/linalg/tolerance_test.py .... [ 14%] cirq/linalg/transformations_test.py ................................. [ 15%] cirq/neutral_atoms/convert_to_neutral_atom_gates_test.py ............... [ 15%] .... [ 15%] cirq/ops/arithmetic_operation_test.py .. [ 15%] cirq/ops/boolean_hamiltonian_test.py ................................... [ 15%] ........................ [ 15%] cirq/ops/classically_controlled_operation_test.py ...................... [ 15%] .................................... [ 16%] cirq/ops/clifford_gate_test.py ......................................... [ 16%] ........................................................................ [ 16%] ........................................................................ [ 17%] ........................................................................ [ 18%] ........................................................................ [ 18%] ........................................................................ [ 19%] ........................................................................ [ 19%] ........................................................................ [ 20%] ........................................................................ [ 20%] ........................................................................ [ 21%] ........................................................................ [ 21%] ........................................................................ [ 22%] ........................................................................ [ 23%] ........................................................................ [ 23%] ................. [ 23%] cirq/ops/common_channels_test.py ....................................... [ 24%] .................................................... [ 24%] cirq/ops/common_gate_families_test.py ............... [ 24%] cirq/ops/common_gates_test.py .......................................... [ 24%] ........................................................................ [ 25%] .................... [ 25%] cirq/ops/control_values_test.py ................................. [ 25%] cirq/ops/controlled_gate_test.py ....................................... [ 26%] ........ [ 26%] cirq/ops/controlled_operation_test.py .............................. [ 26%] cirq/ops/dense_pauli_string_test.py ............................ [ 26%] cirq/ops/diagonal_gate_test.py ................................... [ 26%] cirq/ops/eigen_gate_test.py ............................. [ 27%] cirq/ops/fourier_transform_test.py .......... [ 27%] cirq/ops/fsim_gate_test.py ............................................. [ 27%] ............................. [ 27%] cirq/ops/gate_features_test.py ... [ 27%] cirq/ops/gate_operation_test.py ..F.................................. [ 28%] cirq/ops/gateset_test.py ........F.................................... [ 28%] cirq/ops/global_phase_op_test.py ............................ [ 28%] cirq/ops/identity_test.py ........................ [ 28%] cirq/ops/kraus_channel_test.py .......... [ 28%] cirq/ops/linear_combinations_test.py ................................... [ 29%] ........................................................................ [ 29%] ........................................................................ [ 30%] ............................ [ 30%] cirq/ops/matrix_gates_test.py ........................... [ 30%] cirq/ops/measure_util_test.py .... [ 30%] cirq/ops/measurement_gate_test.py .................................... [ 30%] cirq/ops/mixed_unitary_channel_test.py ........... [ 31%] cirq/ops/named_qubit_test.py ........ [ 31%] cirq/ops/op_tree_test.py ...... [ 31%] cirq/ops/parallel_gate_test.py .............................. [ 31%] cirq/ops/parity_gates_test.py ............................... [ 31%] cirq/ops/pauli_gates_test.py .................... [ 31%] cirq/ops/pauli_interaction_gate_test.py ................................ [ 32%] ........................................................................ [ 32%] ........................................................................ [ 33%] .......... [ 33%] cirq/ops/pauli_measurement_gate_test.py ................................ [ 33%] . [ 33%] cirq/ops/pauli_string_phasor_test.py ................................... [ 33%] ........................................................................ [ 34%] ........................................................................ [ 34%] ........................................................................ [ 35%] ........................................................................ [ 35%] ........................................................................ [ 36%] ........................................................................ [ 37%] ........................................................................ [ 37%] ........................................................................ [ 38%] .................................................................. [ 38%] cirq/ops/pauli_string_raw_types_test.py ... [ 38%] cirq/ops/pauli_string_test.py .......................................... [ 38%] ........................................................................ [ 39%] ........................................................................ [ 40%] ........................................................................ [ 40%] ........................................................................ [ 41%] ........................................................................ [ 41%] ....................... [ 41%] cirq/ops/pauli_sum_exponential_test.py ...................... [ 42%] cirq/ops/permutation_gate_test.py ............. [ 42%] cirq/ops/phased_iswap_gate_test.py ..................................... [ 42%] [ 42%] cirq/ops/phased_x_gate_test.py ......................................... [ 42%] ........................................................................ [ 43%] ........................................................................ [ 43%] ........................................................................ [ 44%] ........................................................................ [ 44%] ........................................................................ [ 45%] .......................................................... [ 45%] cirq/ops/phased_x_z_gate_test.py ................. [ 46%] cirq/ops/projector_test.py ............... [ 46%] cirq/ops/qid_util_test.py .. [ 46%] cirq/ops/qubit_order_test.py ......... [ 46%] cirq/ops/random_gate_channel_test.py ............ [ 46%] cirq/ops/raw_types_test.py ......................................... [ 46%] cirq/ops/state_preparation_channel_test.py ................... [ 46%] cirq/ops/swap_gates_test.py ........................... [ 47%] cirq/ops/tags_test.py .. [ 47%] cirq/ops/three_qubit_gates_test.py ................................... [ 47%] cirq/ops/two_qubit_diagonal_gate_test.py ............ [ 47%] cirq/ops/wait_gate_test.py ......... [ 47%] cirq/protocols/act_on_protocol_test.py ...... [ 47%] cirq/protocols/apply_channel_protocol_test.py ............. [ 47%] cirq/protocols/apply_mixture_protocol_test.py ............. [ 47%] cirq/protocols/apply_unitary_protocol_test.py ............. [ 47%] cirq/protocols/approximate_equality_protocol_test.py ................ [ 47%] cirq/protocols/circuit_diagram_info_protocol_test.py ............ [ 48%] cirq/protocols/commutes_protocol_test.py ... [ 48%] cirq/protocols/control_key_protocol_test.py . [ 48%] cirq/protocols/decompose_protocol_test.py .......... [ 48%] cirq/protocols/equal_up_to_global_phase_protocol_test.py ..... [ 48%] cirq/protocols/has_stabilizer_effect_protocol_test.py ..... [ 48%] cirq/protocols/has_unitary_protocol_test.py ......... [ 48%] cirq/protocols/inverse_protocol_test.py .................. [ 48%] cirq/protocols/json_serialization_test.py ..................x....x...... [ 48%] ..............xx.x...x..x......xxx....x.......................x......x.. [ 49%] ...xx...........................xxx.......x......xx..xx..............sxx [ 49%] ....x...xx........x..x...x..................x........................... [ 50%] ......x....x..s.................xx.x...x..x...ss.xxx....x........s...... [ 50%] ......s.x......x.....xx...................s.......xxx.......x......xx..x [ 51%] x..............sxx.s..x...xx..s.....x..x...xs.................x......... [ 51%] ...sssssssssssssssssssss................................................ [ 52%] ........................................................................ [ 53%] ........................................................................ [ 53%] ................... [ 53%] cirq/protocols/kraus_protocol_test.py ............. [ 53%] cirq/protocols/measurement_key_protocol_test.py ............... [ 54%] cirq/protocols/mixture_protocol_test.py ............ [ 54%] cirq/protocols/mul_protocol_test.py .. [ 54%] cirq/protocols/pauli_expansion_protocol_test.py .............. [ 54%] cirq/protocols/phase_protocol_test.py . [ 54%] cirq/protocols/pow_protocol_test.py ........ [ 54%] cirq/protocols/qasm_test.py . [ 54%] cirq/protocols/qid_shape_protocol_test.py . [ 54%] cirq/protocols/resolve_parameters_test.py ....... [ 54%] cirq/protocols/trace_distance_bound_test.py . [ 54%] cirq/protocols/unitary_protocol_test.py ...... [ 54%] cirq/qis/channels_test.py .............................................. [ 54%] ............ [ 54%] cirq/qis/clifford_tableau_test.py .................. [ 54%] cirq/qis/measures_test.py .............................................. [ 55%] [ 55%] cirq/qis/states_test.py ................................................ [ 55%] .......... [ 55%] cirq/sim/density_matrix_simulation_state_test.py ........ [ 55%] cirq/sim/density_matrix_simulator_test.py .............................. [ 56%] ........................................................................ [ 56%] ........................................................................ [ 57%] ........................................................................ [ 57%] .... [ 57%] cirq/sim/density_matrix_utils_test.py .................................. [ 58%] ............. [ 58%] cirq/sim/mux_test.py ........................ [ 58%] cirq/sim/simulation_product_state_test.py ...................... [ 58%] cirq/sim/simulation_state_test.py ....... [ 58%] cirq/sim/simulator_base_test.py ........................... [ 58%] cirq/sim/simulator_test.py ....................... [ 58%] cirq/sim/sparse_simulator_test.py ...................................... [ 59%] ........................................................................ [ 59%] ........................................................................ [ 60%] ......... [ 60%] cirq/sim/state_vector_simulation_state_test.py ............ [ 60%] cirq/sim/state_vector_simulator_test.py ........ [ 60%] cirq/sim/state_vector_test.py ................................... [ 60%] cirq/sim/clifford/clifford_simulator_test.py ........................... [ 60%] ..................... [ 61%] cirq/sim/clifford/clifford_tableau_simulation_state_test.py ... [ 61%] cirq/sim/clifford/stabilizer_ch_form_simulation_state_test.py ...... [ 61%] cirq/sim/clifford/stabilizer_sampler_test.py .. [ 61%] cirq/sim/clifford/stabilizer_simulation_state_test.py .... [ 61%] cirq/sim/clifford/stabilizer_state_ch_form_test.py .. [ 61%] cirq/study/flatten_expressions_test.py ........... [ 61%] cirq/study/resolver_test.py ...........................x................ [ 61%] ... [ 61%] cirq/study/result_test.py ..................... [ 61%] cirq/study/sweepable_test.py ........................... [ 62%] cirq/study/sweeps_test.py ........................ [ 62%] cirq/testing/circuit_compare_test.py .................. [ 62%] cirq/testing/consistent_act_on_test.py . [ 62%] cirq/testing/consistent_channels_test.py ........ [ 62%] cirq/testing/consistent_controlled_gate_op_test.py . [ 62%] cirq/testing/consistent_decomposition_test.py .. [ 62%] cirq/testing/consistent_pauli_expansion_test.py . [ 62%] cirq/testing/consistent_phase_by_test.py . [ 62%] cirq/testing/consistent_protocols_test.py ... [ 62%] cirq/testing/consistent_qasm_test.py . [ 62%] cirq/testing/consistent_specified_has_unitary_test.py .... [ 62%] cirq/testing/deprecation_test.py .. [ 62%] cirq/testing/devices_test.py .... [ 62%] cirq/testing/equals_tester_test.py ................ [ 62%] cirq/testing/equivalent_basis_map_test.py .. [ 62%] cirq/testing/equivalent_repr_eval_test.py ... [ 62%] cirq/testing/gate_features_test.py .... [ 62%] cirq/testing/json_test.py ... [ 62%] cirq/testing/lin_alg_utils_test.py ............................ [ 63%] cirq/testing/logs_test.py ....... [ 63%] cirq/testing/no_identifier_qubit_test.py ... [ 63%] cirq/testing/op_tree_test.py . [ 63%] cirq/testing/order_tester_test.py ...... [ 63%] cirq/testing/random_circuit_test.py ........................ [ 63%] cirq/testing/repr_pretty_tester_test.py ... [ 63%] cirq/testing/routing_devices_test.py ...... [ 63%] cirq/testing/sample_circuits_test.py . [ 63%] cirq/transformers/align_test.py ....... [ 63%] cirq/transformers/drop_empty_moments_test.py .. [ 63%] cirq/transformers/drop_negligible_operations_test.py ...... [ 63%] cirq/transformers/eject_phased_paulis_test.py .......... [ 63%] cirq/transformers/eject_z_test.py .............................. [ 63%] cirq/transformers/expand_composite_test.py ............ [ 63%] cirq/transformers/measurement_transformers_test.py ..................... [ 64%] ................. [ 64%] cirq/transformers/merge_k_qubit_gates_test.py ......... [ 64%] cirq/transformers/merge_single_qubit_gates_test.py ........ [ 64%] cirq/transformers/optimize_for_target_gateset_test.py ...... [ 64%] cirq/transformers/stratify_test.py ............ [ 64%] cirq/transformers/synchronize_terminal_measurements_test.py .......... [ 64%] cirq/transformers/transformer_api_test.py ............. [ 64%] cirq/transformers/transformer_primitives_test.py ....................... [ 64%] .......... [ 64%] cirq/transformers/analytical_decompositions/clifford_decomposition_test.py . [ 64%] .... [ 64%] cirq/transformers/analytical_decompositions/controlled_gate_decomposition_test.py . [ 64%] ..... [ 65%] cirq/transformers/analytical_decompositions/cphase_to_fsim_test.py ..... [ 65%] ....................................................... [ 65%] cirq/transformers/analytical_decompositions/single_qubit_decompositions_test.py . [ 65%] ........................................................................ [ 66%] ................................ [ 66%] cirq/transformers/analytical_decompositions/single_to_two_qubit_isometry_test.py . [ 66%] ........................................................... [ 66%] cirq/transformers/analytical_decompositions/three_qubit_decomposition_test.py . [ 66%] ....................... [ 66%] cirq/transformers/analytical_decompositions/two_qubit_state_preparation_test.py . [ 66%] ........................................................................ [ 67%] ........................................................................ [ 68%] ........... [ 68%] cirq/transformers/analytical_decompositions/two_qubit_to_cz_test.py .... [ 68%] ........................................................................ [ 68%] [ 68%] cirq/transformers/analytical_decompositions/two_qubit_to_fsim_test.py .. [ 68%] ........................................................................ [ 69%] ........................................................................ [ 69%] ........................................................................ [ 70%] .............................................. [ 70%] cirq/transformers/analytical_decompositions/two_qubit_to_ms_test.py .... [ 70%] ........................................ [ 71%] cirq/transformers/analytical_decompositions/two_qubit_to_sqrt_iswap_test.py . [ 71%] ........................................................................ [ 71%] ........................................................................ [ 72%] ........................................................................ [ 72%] ........................................................................ [ 73%] ........................................................................ [ 73%] ........................................................................ [ 74%] ........................................................................ [ 74%] ........................................................................ [ 75%] ........................................................................ [ 76%] ........................................................................ [ 76%] ........................................................................ [ 77%] ........................................................................ [ 77%] ........................................................................ [ 78%] ........................................................................ [ 78%] ........................................................................ [ 79%] ........................................................................ [ 79%] ........................................................................ [ 80%] ........................................................................ [ 80%] ........................................................................ [ 81%] ........................................................................ [ 82%] ........................................................................ [ 82%] ........................................................................ [ 83%] ........................................................................ [ 83%] ........................................................................ [ 84%] ........................................................................ [ 84%] ........................................................................ [ 85%] ........................................................................ [ 85%] ........................................................................ [ 86%] ........................................................................ [ 87%] ........................................................................ [ 87%] ........................................................................ [ 88%] ........................................................................ [ 88%] ........................................................................ [ 89%] ........................................................................ [ 89%] ........................................................................ [ 90%] ........................................................................ [ 90%] ........................................................................ [ 91%] ........................................................................ [ 92%] ........................................................................ [ 92%] ........................................................................ [ 93%] ........................................................................ [ 93%] .................................................... [ 94%] cirq/transformers/heuristic_decompositions/gate_tabulation_math_utils_test.py . [ 94%] ... [ 94%] cirq/transformers/heuristic_decompositions/two_qubit_gate_tabulation_test.py . [ 94%] ........................................................................ [ 94%] ........................................................................ [ 95%] ............................................................... [ 95%] cirq/transformers/routing/initial_mapper_test.py . [ 95%] cirq/transformers/routing/line_initial_mapper_test.py .................. [ 95%] ......... [ 95%] cirq/transformers/routing/mapping_manager_test.py ..... [ 95%] cirq/transformers/routing/route_circuit_cqc_test.py .................... [ 96%] ....... [ 96%] cirq/transformers/routing/visualize_routed_circuit_test.py .. [ 96%] cirq/transformers/target_gatesets/compilation_target_gateset_test.py ... [ 96%] ..... [ 96%] cirq/transformers/target_gatesets/cz_gateset_test.py .................. [ 96%] cirq/transformers/target_gatesets/sqrt_iswap_gateset_test.py ........... [ 96%] ................. [ 96%] cirq/value/abc_alt_test.py ........ [ 96%] cirq/value/angle_test.py ... [ 96%] cirq/value/classical_data_test.py .......F [ 96%] cirq/value/condition_test.py .......... [ 96%] cirq/value/digits_test.py .... [ 96%] cirq/value/duration_test.py ................. [ 96%] cirq/value/linear_dict_test.py ......................................... [ 97%] ........................................................................ [ 97%] ....................................... [ 98%] cirq/value/measurement_key_test.py .......... [ 98%] cirq/value/periodic_value_test.py .................... [ 98%] cirq/value/probability_test.py ...... [ 98%] cirq/value/product_state_test.py ................ [ 98%] cirq/value/random_state_test.py . [ 98%] cirq/value/timestamp_test.py ........ [ 98%] cirq/value/value_equality_attr_test.py ........... [ 98%] cirq/vis/density_matrix_test.py ..................................... [ 98%] cirq/vis/heatmap_test.py ...................................... [ 99%] cirq/vis/histogram_test.py ... [ 99%] cirq/vis/state_histogram_test.py ..... [ 99%] cirq/vis/vis_utils_test.py . [ 99%] cirq/work/collector_test.py ....... [ 99%] cirq/work/observable_grouping_test.py ........ [ 99%] cirq/work/observable_measurement_data_test.py ............. [ 99%] cirq/work/observable_measurement_test.py ......................... [ 99%] cirq/work/observable_readout_calibration_test.py . [ 99%] cirq/work/observable_settings_test.py ....... [ 99%] cirq/work/pauli_sum_collector_test.py ..... [ 99%] cirq/work/sampler_test.py .................... [ 99%] cirq/work/zeros_sampler_test.py .... [100%] =================================== FAILURES =================================== ________________________________ test_immutable ________________________________ def test_immutable(): q = cirq.LineQubit(0) c = cirq.FrozenCircuit(cirq.X(q), cirq.H(q)) with pytest.raises(AttributeError, match="can't set attribute"): > c.moments = (cirq.Moment(cirq.H(q)), cirq.Moment(cirq.X(q))) E AttributeError: property 'moments' of 'FrozenCircuit' object has no setter cirq/circuits/frozen_circuit_test.py:72: AttributeError During handling of the above exception, another exception occurred: def test_immutable(): q = cirq.LineQubit(0) c = cirq.FrozenCircuit(cirq.X(q), cirq.H(q)) > with pytest.raises(AttributeError, match="can't set attribute"): E AssertionError: Regex pattern did not match. E Regex: "can't set attribute" E Input: "property 'moments' of 'FrozenCircuit' object has no setter" cirq/circuits/frozen_circuit_test.py:71: AssertionError ________________________________ test_immutable ________________________________ def test_immutable(): with pytest.raises(AttributeError, match="can't set attribute"): q = cirq.GridQubit(1, 2) > q.col = 3 E AttributeError: property 'col' of 'GridQubit' object has no setter cirq/devices/grid_qubit_test.py:340: AttributeError During handling of the above exception, another exception occurred: def test_immutable(): > with pytest.raises(AttributeError, match="can't set attribute"): E AssertionError: Regex pattern did not match. E Regex: "can't set attribute" E Input: "property 'col' of 'GridQubit' object has no setter" cirq/devices/grid_qubit_test.py:338: AssertionError ________________________________ test_immutable ________________________________ def test_immutable(): with pytest.raises(AttributeError, match="can't set attribute"): q = cirq.LineQubit(5) > q.x = 6 E AttributeError: property 'x' of 'LineQubit' object has no setter cirq/devices/line_qubit_test.py:247: AttributeError During handling of the above exception, another exception occurred: def test_immutable(): > with pytest.raises(AttributeError, match="can't set attribute"): E AssertionError: Regex pattern did not match. E Regex: "can't set attribute" E Input: "property 'x' of 'LineQubit' object has no setter" cirq/devices/line_qubit_test.py:245: AssertionError ________________________________ test_immutable ________________________________ def test_immutable(): a, b = cirq.LineQubit.range(2) op = cirq.X(a) with pytest.raises(AttributeError, match="can't set attribute"): > op.gate = cirq.Y E AttributeError: property 'gate' of 'SingleQubitPauliStringGateOperation' object has no setter cirq/ops/gate_operation_test.py:45: AttributeError During handling of the above exception, another exception occurred: def test_immutable(): a, b = cirq.LineQubit.range(2) op = cirq.X(a) > with pytest.raises(AttributeError, match="can't set attribute"): E AssertionError: Regex pattern did not match. E Regex: "can't set attribute" E Input: "property 'gate' of 'SingleQubitPauliStringGateOperation' object has no setter" cirq/ops/gate_operation_test.py:44: AssertionError __________________________ test_gate_family_immutable __________________________ def test_gate_family_immutable(): g = cirq.GateFamily(CustomX) with pytest.raises(AttributeError, match="can't set attribute"): > g.gate = CustomXPowGate E AttributeError: property 'gate' of 'GateFamily' object has no setter cirq/ops/gateset_test.py:98: AttributeError During handling of the above exception, another exception occurred: def test_gate_family_immutable(): g = cirq.GateFamily(CustomX) > with pytest.raises(AttributeError, match="can't set attribute"): E AssertionError: Regex pattern did not match. E Regex: "can't set attribute" E Input: "property 'gate' of 'GateFamily' object has no setter" cirq/ops/gateset_test.py:97: AssertionError __________________________________ test_repr ___________________________________ value = cirq.ClassicalDataDictionaryStore(_records={cirq.MeasurementKey(name='m'): [(0, 1)]}, _measured_qubits={cirq.Measureme...ey(name='c'): [3]}, _measurement_types={cirq.MeasurementKey(name='m'): cirq.1, cirq.MeasurementKey(name='c'): cirq.2},) def assert_equivalent_repr( value: Any, *, setup_code: str = ( 'import cirq\nimport numpy as np\nimport sympy\nimport pandas as pd\nimport datetime\n' ), global_vals: Optional[Dict[str, Any]] = None, local_vals: Optional[Dict[str, Any]] = None, ) -> None: """Checks that eval(repr(v)) == v. Args: value: A value whose repr should be evaluatable python code that produces an equivalent value. setup_code: Code that must be executed before the repr can be evaluated. Ideally this should just be a series of 'import' lines. global_vals: Pre-defined values that should be in the global scope when evaluating the repr. local_vals: Pre-defined values that should be in the local scope when evaluating the repr. Raises: AssertionError: If the assertion fails, or eval(repr(value)) raises an error. """ __tracebackhide__ = True # pylint: disable=unused-variable global_vals = global_vals or {} local_vals = local_vals or {} exec(setup_code, global_vals, local_vals) try: > eval_repr_value = eval(repr(value), global_vals, local_vals) E File "", line 1 E cirq.ClassicalDataDictionaryStore(_records={cirq.MeasurementKey(name='m'): [(0, 1)]}, _measured_qubits={cirq.MeasurementKey(name='m'): [(cirq.LineQubit(0), cirq.LineQubit(1))]}, _channel_records={cirq.MeasurementKey(name='c'): [3]}, _measurement_types={cirq.MeasurementKey(name='m'): cirq.1, cirq.MeasurementKey(name='c'): cirq.2},) E ^^^^^^ E SyntaxError: invalid syntax. Perhaps you forgot a comma? cirq/testing/equivalent_repr_eval.py:50: SyntaxError During handling of the above exception, another exception occurred: def test_repr(): cd = cirq.ClassicalDataDictionaryStore( _records={mkey_m: [(0, 1)]}, _measured_qubits={mkey_m: [two_qubits]}, _channel_records={mkey_c: [3]}, _measurement_types={ mkey_m: cirq.MeasurementType.MEASUREMENT, mkey_c: cirq.MeasurementType.CHANNEL, }, ) > cirq.testing.assert_equivalent_repr(cd) E AssertionError: eval(repr(value)) raised an exception. E E setup_code=import cirq E import numpy as np E import sympy E import pandas as pd E import datetime E E type(value): E value=cirq.ClassicalDataDictionaryStore(_records={cirq.MeasurementKey(name='m'): [(0, 1)]}, _measured_qubits={cirq.MeasurementKey(name='m'): [(cirq.LineQubit(0), cirq.LineQubit(1))]}, _channel_records={cirq.MeasurementKey(name='c'): [3]}, _measurement_types={cirq.MeasurementKey(name='m'): cirq.1, cirq.MeasurementKey(name='c'): cirq.2},) E error=SyntaxError('invalid syntax. Perhaps you forgot a comma?', ('', 1, 285, "cirq.ClassicalDataDictionaryStore(_records={cirq.MeasurementKey(name='m'): [(0, 1)]}, _measured_qubits={cirq.MeasurementKey(name='m'): [(cirq.LineQubit(0), cirq.LineQubit(1))]}, _channel_records={cirq.MeasurementKey(name='c'): [3]}, _measurement_types={cirq.MeasurementKey(name='m'): cirq.1, cirq.MeasurementKey(name='c'): cirq.2},)", 1, 291)) cirq/value/classical_data_test.py:142: AssertionError =============================== warnings summary =============================== cirq-core/cirq/_compat_test.py::test_metadata_distributions_after_deprecated_submodule /build/source/cirq-core/cirq/_compat_test.py:626: UserWarning: Skipping: Skipped: could not import 'importlib_metadata': No module named 'importlib_metadata' Traceback (most recent call last): File "/build/source/cirq-core/cirq/_compat_test.py", line 595, in _trace_unhandled_exceptions func(*args, **kwargs) File "/build/source/cirq-core/cirq/_compat_test.py", line 743, in _test_metadata_distributions_after_deprecated_submodule m = pytest.importorskip("importlib_metadata") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/v1lach14w5vpahy057wphv9pwam6wplh-python3.11-pytest-7.2.0/lib/python3.11/site-packages/_pytest/outcomes.py", line 293, in importorskip raise Skipped(reason, allow_module_level=True) from None Skipped: could not import 'importlib_metadata': No module named 'importlib_metadata' warnings.warn(f"Skipping: {ex_type}: {msg}\n{ex_trace}") cirq-core/cirq/circuits/qasm_output_test.py: 3 warnings cirq-core/cirq/ops/boolean_hamiltonian_test.py: 6 warnings cirq-core/cirq/ops/common_gates_test.py: 90 warnings cirq-core/cirq/ops/controlled_gate_test.py: 116 warnings cirq-core/cirq/ops/controlled_operation_test.py: 356 warnings cirq-core/cirq/ops/dense_pauli_string_test.py: 32 warnings cirq-core/cirq/ops/diagonal_gate_test.py: 36 warnings cirq-core/cirq/ops/fourier_transform_test.py: 48 warnings cirq-core/cirq/ops/fsim_gate_test.py: 72 warnings cirq-core/cirq/ops/global_phase_op_test.py: 30 warnings cirq-core/cirq/ops/identity_test.py: 24 warnings cirq-core/cirq/ops/matrix_gates_test.py: 55 warnings cirq-core/cirq/ops/measurement_gate_test.py: 16 warnings cirq-core/cirq/ops/parallel_gate_test.py: 24 warnings cirq-core/cirq/ops/parity_gates_test.py: 45 warnings cirq-core/cirq/ops/pauli_interaction_gate_test.py: 216 warnings cirq-core/cirq/ops/pauli_measurement_gate_test.py: 12 warnings cirq-core/cirq/ops/pauli_string_phasor_test.py: 12 warnings cirq-core/cirq/ops/pauli_string_test.py: 58 warnings cirq-core/cirq/ops/permutation_gate_test.py: 12 warnings cirq-core/cirq/ops/phased_iswap_gate_test.py: 114 warnings cirq-core/cirq/ops/phased_x_gate_test.py: 72 warnings cirq-core/cirq/ops/phased_x_z_gate_test.py: 12 warnings cirq-core/cirq/ops/random_gate_channel_test.py: 8 warnings cirq-core/cirq/ops/raw_types_test.py: 6 warnings cirq-core/cirq/ops/swap_gates_test.py: 54 warnings cirq-core/cirq/ops/three_qubit_gates_test.py: 57 warnings cirq-core/cirq/ops/two_qubit_diagonal_gate_test.py: 24 warnings cirq-core/cirq/ops/wait_gate_test.py: 9 warnings cirq-core/cirq/testing/consistent_protocols_test.py: 40 warnings /build/source/cirq-core/cirq/testing/consistent_qasm.py:31: UserWarning: Skipped assert_qasm_is_consistent_with_unitary because qiskit isn't installed to verify against. warnings.warn( cirq-core/cirq/ops/clifford_gate_test.py: 45 warnings cirq-core/cirq/protocols/json_serialization_test.py: 1 warning cirq-core/cirq/qis/clifford_tableau_test.py: 9 warnings :1: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations cirq-core/cirq/ops/dense_pauli_string_test.py::test_protocols /build/source/cirq-core/cirq/study/resolver.py:169: RuntimeWarning: divide by zero encountered in float_power return np.float_power(cast(complex, base), cast(complex, exponent)) cirq-core/cirq/testing/consistent_qasm_test.py::test_assert_qasm_is_consistent_with_unitary /build/source/cirq-core/cirq/testing/consistent_qasm_test.py:59: UserWarning: Skipped test_assert_qasm_is_consistent_with_unitary because qiskit isn't installed to verify against. warnings.warn( cirq-core/cirq/vis/heatmap_test.py::test_cell_colors[viridis] cirq-core/cirq/vis/heatmap_test.py::test_cell_colors[Greys] cirq-core/cirq/vis/heatmap_test.py::test_cell_colors[binary] cirq-core/cirq/vis/heatmap_test.py::test_cell_colors[PiYG] cirq-core/cirq/vis/heatmap_test.py::test_cell_colors[twilight] cirq-core/cirq/vis/heatmap_test.py::test_cell_colors[Pastel1] cirq-core/cirq/vis/heatmap_test.py::test_cell_colors[flag] /build/source/cirq-core/cirq/vis/heatmap_test.py:100: PendingDeprecationWarning: The get_cmap function will be deprecated in a future version. Use ``matplotlib.colormaps[name]`` or ``matplotlib.colormaps.get_cmap(obj)`` instead. colormap = mpl.cm.get_cmap(colormap_name) cirq-core/cirq/vis/heatmap_test.py::test_non_float_values[.3e] cirq-core/cirq/vis/heatmap_test.py::test_non_float_values[.2f] cirq-core/cirq/vis/heatmap_test.py::test_non_float_values[.4g] cirq-core/cirq/vis/heatmap_test.py::test_non_float_values[s] /build/source/cirq-core/cirq/vis/heatmap_test.py:221: PendingDeprecationWarning: The get_cmap function will be deprecated in a future version. Use ``matplotlib.colormaps[name]`` or ``matplotlib.colormaps.get_cmap(obj)`` instead. colormap = mpl.cm.get_cmap(colormap_name) cirq-core/cirq/work/observable_measurement_data_test.py::test_bitstring_accumulator_errors /nix/store/l57yh0gp1v1vc2yrma3sgf1hlbsrsl7m-python3.11-numpy-1.23.5/lib/python3.11/site-packages/numpy/core/fromnumeric.py:3715: RuntimeWarning: Degrees of freedom <= 0 for slice return _methods._var(a, axis=axis, dtype=dtype, out=out, ddof=ddof, cirq-core/cirq/work/observable_measurement_data_test.py::test_bitstring_accumulator_errors /nix/store/l57yh0gp1v1vc2yrma3sgf1hlbsrsl7m-python3.11-numpy-1.23.5/lib/python3.11/site-packages/numpy/core/_methods.py:257: RuntimeWarning: invalid value encountered in double_scalars ret = ret.dtype.type(ret / rcount) ../../../nix/store/v1lach14w5vpahy057wphv9pwam6wplh-python3.11-pytest-7.2.0/lib/python3.11/site-packages/_pytest/cacheprovider.py:433 /nix/store/v1lach14w5vpahy057wphv9pwam6wplh-python3.11-pytest-7.2.0/lib/python3.11/site-packages/_pytest/cacheprovider.py:433: PytestCacheWarning: could not create cache path /build/source/.pytest_cache/v/cache/nodeids config.cache.set("cache/nodeids", sorted(self.cached_nodeids)) ../../../nix/store/v1lach14w5vpahy057wphv9pwam6wplh-python3.11-pytest-7.2.0/lib/python3.11/site-packages/_pytest/cacheprovider.py:387 /nix/store/v1lach14w5vpahy057wphv9pwam6wplh-python3.11-pytest-7.2.0/lib/python3.11/site-packages/_pytest/cacheprovider.py:387: PytestCacheWarning: could not create cache path /build/source/.pytest_cache/v/cache/lastfailed config.cache.set("cache/lastfailed", self.lastfailed) ../../../nix/store/v1lach14w5vpahy057wphv9pwam6wplh-python3.11-pytest-7.2.0/lib/python3.11/site-packages/_pytest/stepwise.py:52 /nix/store/v1lach14w5vpahy057wphv9pwam6wplh-python3.11-pytest-7.2.0/lib/python3.11/site-packages/_pytest/stepwise.py:52: PytestCacheWarning: could not create cache path /build/source/.pytest_cache/v/cache/stepwise session.config.cache.set(STEPWISE_CACHE_DIR, []) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED cirq/circuits/frozen_circuit_test.py::test_immutable - AssertionError: Regex pattern did not match. FAILED cirq/devices/grid_qubit_test.py::test_immutable - AssertionError: Regex pattern did not match. FAILED cirq/devices/line_qubit_test.py::test_immutable - AssertionError: Regex pattern did not match. FAILED cirq/ops/gate_operation_test.py::test_immutable - AssertionError: Regex pattern did not match. FAILED cirq/ops/gateset_test.py::test_gate_family_immutable - AssertionError: Regex pattern did not match. FAILED cirq/value/classical_data_test.py::test_repr - AssertionError: eval(repr(value)) raised an exception. = 6 failed, 12966 passed, 33 skipped, 5 deselected, 65 xfailed, 1733 warnings in 156.98s (0:02:36) = ```

How to reproduce the issue Run pytest in cirq-core/, using Python 3.11.2.

Cirq version 1.1.0

tanujkhattar commented 1 year ago

I think this is important to fix soon, should be relatively straightforward and would unblock support for Python 3.11

cc @navaro1 - In case you are looking for important things to work upon. I'll get back to your serialization PR soon; that one was more ambiguous in terms of requirements so it's taking longer than usual.

navaro1 commented 1 year ago

@tanujkhattar, feel free to assign to me.

navaro1 commented 1 year ago

@tanujkhattar, FYI: https://github.com/quantumlib/Cirq/pull/6181

tanujkhattar commented 11 months ago

This is now fixed and Python 3.11 tests are added to CI after https://github.com/quantumlib/Cirq/pull/6191