Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Ensure adding programs doesn't mutate the first (#1477)
Closes #1476 As noted in #1476, adding programs (like `p1 + p2`) currently mutates the first program (i.e. `p1` would change). This PR ensures that calibrations et. al. are copied rather than just assigned, and adds a new test case to `unit/test_program.py` to ensure against regression: ```shell $ poetry run pytest test/unit/test_program.py --verbose ==================================== test session starts ===================================== platform darwin -- Python 3.9.13, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /Users/genos/rc/repos/pyquil/.venv/bin/python cachedir: .pytest_cache rootdir: /Users/genos/rc/repos/pyquil plugins: cov-2.12.1, freezegun-0.4.2, rerunfailures-9.1.1, xdist-2.3.0, mock-3.6.1, timeout-1.4.2, forked-1.3.0 collected 5 items test/unit/test_program.py::test_measure_qubits PASSED [ 20%] test/unit/test_program.py::test_parameterized_single_qubit_measurement_basis PASSED [ 40%] test/unit/test_program.py::test_parameterized_single_qubit_state_preparation PASSED [ 60%] test/unit/test_program.py::test_parameterized_readout_symmetrization PASSED [ 80%] test/unit/test_program.py::test_adding_does_not_mutate PASSED [100%] ```
- Loading branch information