Skip to content

Comments

Improve coverage for amazon_braket_backend.py to 99% by covering regi…#1082

Open
alisha-1000 wants to merge 2 commits intoapache:mainfrom
alisha-1000:improve-amazon-braket-backend-coverage
Open

Improve coverage for amazon_braket_backend.py to 99% by covering regi…#1082
alisha-1000 wants to merge 2 commits intoapache:mainfrom
alisha-1000:improve-amazon-braket-backend-coverage

Conversation

@alisha-1000
Copy link

Related Issues

Closes #1058

Changes

  • Test

Why

The current coverage for qumat/amazon_braket_backend.py was around ~90%.
This PR improves coverage to 99% by adding unit tests for previously uncovered branches.

Improving coverage in backend modules increases reliability and ensures
correct handling of edge cases such as AWS session initialization and parameter filtering.

How

Added unit tests covering:

  • Backend initialization:

    • Local simulator
    • Default simulator
    • Unsupported simulator type fallback
    • Region-based AWS session creation
  • Gate helper wrappers (RX/RY/RZ/U and other single-qubit/multi-qubit gates)

  • execute_circuit:

    • With parameters
    • Without parameters
    • Parameter filtering logic
  • get_final_state_vector:

    • With parameters
    • Without parameters
    • Ensured state_vector() path is exercised
  • calculate_prob_zero edge cases

Coverage impact:

  • amazon_braket_backend.py: ~90% → 99%

Checklist

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

…on handling, execution branches, and state vector path
@guan404ming
Copy link
Member

Please help handle the pre-commit error in ci, thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this change?

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.

[Feature] Enhance Module Testing Coverage

3 participants