Skip to content

fix: treat scalar observables as one observable - #1343

Merged
speller26 merged 2 commits into
amazon-braket:mainfrom
danielgaskins:fix/scalar-circuit-binding-observables
Aug 29, 2026
Merged

fix: treat scalar observables as one observable#1343
speller26 merged 2 commits into
amazon-braket:mainfrom
danielgaskins:fix/scalar-circuit-binding-observables

Conversation

@danielgaskins

Copy link
Copy Markdown
Contributor

Issue #, if available:

Closes #1341

Description of changes:

CircuitBinding now accepts a single Observable, PauliString, or Pauli word string and treats it as one observable. This keeps multi-qubit Pauli words intact and preserves signed Pauli strings.

ProgramSet.product() accepts the same scalar inputs. ProgramSet.zip() is unchanged because its observables are matched positionally to circuits.

Testing done:

  • pytest -n 0 -q test/unit_tests/braket/program_sets
  • ruff format --check src/braket/program_sets/circuit_binding.py src/braket/program_sets/program_set.py test/unit_tests/braket/program_sets/test_circuit_binding.py test/unit_tests/braket/program_sets/test_program_set.py
  • ruff check src
  • mypy

Merge Checklist

General

  • I have read the contributing guide
  • I used the required PR title format
  • I updated the relevant type hints and API documentation

Tests

  • I added tests that prove the fix works
  • The tests do not depend on a specific region or account

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Signed-off-by: Daniel Gaskins <danielgaskins99@gmail.com>
@danielgaskins
danielgaskins requested a review from a team as a code owner August 25, 2026 00:45
@speller26
speller26 self-requested a review August 25, 2026 20:06
@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (0da16fe) to head (d2ea760).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1343   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          171       171           
  Lines        11590     11594    +4     
  Branches      1517      1518    +1     
=========================================
+ Hits         11590     11594    +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@speller26
speller26 merged commit 65dfe83 into amazon-braket:main Aug 29, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CircuitBinding: bare string passed as observables is silently iterated per character

2 participants