Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Unit Tests #2365

Open
5 of 22 tasks
purva-thakre opened this issue May 13, 2024 · 4 comments
Open
5 of 22 tasks

Missing Unit Tests #2365

purva-thakre opened this issue May 13, 2024 · 4 comments
Labels
infrastructure For issues related to building, packaging, and continuous integration.

Comments

@purva-thakre
Copy link
Collaborator

purva-thakre commented May 13, 2024

Noticed some lines in the following files show up as uncovered by unit tests in the pytest coverage report. This issue is to figure out if these lines require additional unit tests or if they erroneously show up as uncovered in the pytest report.

  • mitiq/_about.py: L 21-59, 63
  • mitiq/benchmarks/mirror_circuits.py: L 155
  • mitiq/benchmarks/randomized_benchmarking.py: L 54
  • mitiq/benchmarks/randomized_clifford_t_circuit.py: L 43, 47
  • mitiq/calibration/calibrator.py: L 385, 432
  • mitiq/calibration/settings.py: L 185, 244-246, 269, 318
  • mitiq/cdr/_testing.py: L 11-15
  • mitiq/cdr/clifford_training_data.py: L 232
  • mitiq/cdr/clifford_utils.py: L 79-81
  • mitiq/executor/executor.py : L 141, 205
  • mitiq/interface/mitiq_braket/conversions.py : L 324
  • mitiq/interface/mitiq_qiskit/conversions.py : L 169
  • mitiq/observable/observable.py: L 84, 89
  • mitiq/observable/pauli.py: L 48, 55, 122, 166, 178
  • mitiq/pec/representations/optimal.py: L 149
  • mitiq/pec/types/types.py : L 239
  • mitiq/shadows/quantum_processing.py: L 140 Ignored temporarily due to Make changes to the functions in mitiq.shadows #2129
  • mitiq/shadows/shadows.py: L 68, 73, 78, 137 Ignored temporarily due to Make changes to the functions in mitiq.shadows #2129
  • mitiq/shadows/shadows_utils.py: L 61, 88, 91-96 Ignored temporarily due to Make changes to the functions in mitiq.shadows #2129
  • mitiq/zne/inference.py: L 990, 1253, 1331, 1333, 1335, 1415, 1454, 1460-1461, 1588
  • mitiq/zne/scaling/folding.py: L 119, 294
  • mitiq/zne/zne.py: L 59

Will update the issue description later with more details about the specific lines.

@cosenal
Copy link
Contributor

cosenal commented May 15, 2024

Happy to go through this exercise, with the caveat that one could make the The Case Against 100% Code Coverage.

@purva-thakre
Copy link
Collaborator Author

purva-thakre commented May 17, 2024

The caveat is understandable. I don't go by the coverage percentage. That value fluctuates inconsistently and it's still not clear to me how it is calculated.

Typically, I look at the uncovered lines in the pytest coverage report to make pytest ignore some lines from the coverage report or add unit tests. Perhaps we should discuss what type of unit tests should be added and which ones could be ignored.

For example, I don't think we need unit tests for mitiq/_about.py but # pragma: no cover is ignored by the pytest coverage report. So, we will have to create a PR to make pyest ignore these.

mitiq/mitiq/_about.py

Lines 26 to 29 in aefc5ce

try:
from qiskit import __qiskit_version__ # pragma: no cover
qiskit_version = __qiskit_version__["qiskit"] # pragma: no cover

@cosenal
Copy link
Contributor

cosenal commented May 17, 2024

That value fluctuates inconsistently

It should no longer fluctuate, after #2319, which fixed #2318

@purva-thakre
Copy link
Collaborator Author

purva-thakre commented May 18, 2024

Closely related to this issue, the following lines are ignored in the pytest coverage report. A unit test could be added to raise the error similar to some of the changes in #2366

Unless I am missing something and we can't raise this error?

raise ValueError( # pragma: no cover
"Only single-qubit operations are supported." # pragma: no cover
) # pragma: no cover

@natestemen natestemen added the infrastructure For issues related to building, packaging, and continuous integration. label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure For issues related to building, packaging, and continuous integration.
Projects
None yet
Development

No branches or pull requests

3 participants