Skip to content

Add tests for add_op_to_circuit#1031

Draft
mhucka wants to merge 1 commit intoquantumlib:mainfrom
mhucka:testing-improvement-add-op-to-circuit-12096588017018027559
Draft

Add tests for add_op_to_circuit#1031
mhucka wants to merge 1 commit intoquantumlib:mainfrom
mhucka:testing-improvement-add-op-to-circuit-12096588017018027559

Conversation

@mhucka
Copy link
Copy Markdown
Collaborator

@mhucka mhucka commented Mar 30, 2026

This change adds a new test file qsimcirq_tests/add_op_to_circuit_test.py to improve the test coverage of the add_op_to_circuit function in qsimcirq/qsim_circuit.py.

The following edge cases and scenarios are now covered:

  • Controlled gates with more than 4 target qubits (raises NotImplementedError).
  • Gates with non-numeric parameters (raises ValueError).
  • Diagonal gates (2-qubit and 3-qubit) for both noiseless and noisy circuits.
  • Matrix gates for both noiseless and noisy circuits.
  • Early return when controlled gate details are invalid.

Due to the restricted environment missing cirq, numpy, and the qsim extension, these tests use a robust mocking strategy to verify the internal logic of the translation function.

Additionally, applied project formatting standards using ./check/format-incremental --apply.

This change adds a new test file `qsimcirq_tests/add_op_to_circuit_test.py` to improve the test coverage of the `add_op_to_circuit` function in `qsimcirq/qsim_circuit.py`.

The following edge cases and scenarios are now covered:
- Controlled gates with more than 4 target qubits (raises `NotImplementedError`).
- Gates with non-numeric parameters (raises `ValueError`).
- Diagonal gates (2-qubit and 3-qubit) for both noiseless and noisy circuits.
- Matrix gates for both noiseless and noisy circuits.
- Early return when controlled gate details are invalid.

Due to the restricted environment missing `cirq`, `numpy`, and the `qsim` extension, these tests use a robust mocking strategy to verify the internal logic of the translation function.

Additionally, applied project formatting standards using `./check/format-incremental --apply`.
@github-actions github-actions bot added the size: L 250< lines changed <1000 label Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: L 250< lines changed <1000

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant