Skip to content

Improve test coverage for qiskit_backend.py to 99%#1112

Open
Howardisme wants to merge 4 commits intoapache:mainfrom
Howardisme:qiskit-testing-coverage
Open

Improve test coverage for qiskit_backend.py to 99%#1112
Howardisme wants to merge 4 commits intoapache:mainfrom
Howardisme:qiskit-testing-coverage

Conversation

@Howardisme
Copy link

Related Issues

Related to #1058

Changes

  • Bug fix
  • New feature
  • Refactoring
  • Documentation
  • Test
  • CI/CD pipeline
  • Other

Why

This PR improves the test coverage for the qiskit_backend.py module by addressing few previously untested code paths.
and also improves some test coverage for all backends(cirq_backend.py, amazon_braket_backend.py).

How

Add unit tests covering:

  • Backend Initialization (add test_qiskit_custom_simulator_fallback):

    • Triggered the else block of initialize_backend using a mock setup ("simulator_type": "matrix_product_state"). Evaluates the correct propagation of the configuration parameter through to the underlying AerSimulator.
  • Circuit Visualization (add test_draw_circuit_returns_output):

    • Validated the rendering function (draw_circuit) in multiple backend configurations by creating class TestCircuitDrawing. Testing all backends as well.
  • Swap Operation (add test_apply_swap_gate):

    • Tested the swap gate function (apply_swap_gate) by initiating state (|10⟩ by a Pauli-X), executing apply_swap_gate, and then checked the operation returned successfully in qumat execution contexts. Testing all backends as well.

Coverage Improve:

  • qiskit_backend.py: 95% → 99%
  • amazon_braket_backend.py: 99% → 100%
  • cirq_backend.py: 93% → 97%
  • qumat.py: 92% → 97%

Checklist

  • Added or updated unit tests for all changes
  • Added or updated documentation for all changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant