Skip to content

Add argument check to move_pauli_strings_into_circuit#7985

Merged
pavoljuhas merged 9 commits intoquantumlib:mainfrom
Acciaccatura:issue7934
Apr 29, 2026
Merged

Add argument check to move_pauli_strings_into_circuit#7985
pavoljuhas merged 9 commits intoquantumlib:mainfrom
Acciaccatura:issue7934

Conversation

@Acciaccatura
Copy link
Copy Markdown
Contributor

@Acciaccatura Acciaccatura commented Mar 29, 2026

The circuit_left argument of move_pauli_strings_into_circuit
should contain only a PauliStringPhasor-type operations.
Raise exception if that is not the case.

Fixes #7934

@Acciaccatura Acciaccatura requested review from a team and vtomole as code owners March 29, 2026 23:43
@github-actions github-actions Bot added the Size: XS <10 lines changed label Mar 29, 2026
@pavoljuhas pavoljuhas self-requested a review April 1, 2026 19:55
@github-actions github-actions Bot added size: S 10< lines changed <50 and removed Size: XS <10 lines changed labels Apr 10, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.63%. Comparing base (f55763c) to head (e123cbe).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7985   +/-   ##
=======================================
  Coverage   99.63%   99.63%           
=======================================
  Files        1110     1110           
  Lines      100020   100028    +8     
=======================================
+ Hits        99658    99666    +8     
  Misses        362      362           

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pavoljuhas pavoljuhas self-assigned this Apr 21, 2026
Ensure error message cannot get too long for larget circuit_left.

Simplify the test of the new argument validation.
Just repeat example from the addressed issue quantumlib#7934.
@pavoljuhas pavoljuhas changed the title Add an exception requiring PauliStringPhasors only in the left circuit argument for contrib.paulistring.move_pauli_strings_into_circuit. Add argument check for move_pauli_strings_into_circuit Apr 29, 2026
@pavoljuhas pavoljuhas changed the title Add argument check for move_pauli_strings_into_circuit Add argument check to move_pauli_strings_into_circuit Apr 29, 2026
@pavoljuhas
Copy link
Copy Markdown
Collaborator

pavoljuhas commented Apr 29, 2026

NB - I am moving the initial description here so the description can be reworded as a commit message


No tests exist for this change (AFAIK), perhaps we should add one? If so, I may need some guidance on what to test for as my QC knowledge is lacking.

It is sufficient to verify that the new exception is raised. I have tweaked the test in 3aa9879 so it corresponds to the addressed issue

Same with adding a docstring - shall we explicitly state what this function is doing, and/or what it requires, or is it OK to leave it as-is?

The function is in the contrib submodule and does not appear to be much used. For now it is OK to leave the docstring as is.

Copy link
Copy Markdown
Collaborator

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

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

LGTM after pushing in a couple of tweaks.

@Acciaccatura - please check if this is good to go from your POV.

@mhucka mhucka added the triage/discuss Needs decision / discussion, bring these up during Cirq Cynque label Apr 29, 2026
@pavoljuhas pavoljuhas added this pull request to the merge queue Apr 29, 2026
Merged via the queue into quantumlib:main with commit af4e48d Apr 29, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: S 10< lines changed <50 triage/discuss Needs decision / discussion, bring these up during Cirq Cynque

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AttributeError: 'SingleQubitPauliStringGateOperation' object has no attribute 'pauli_string' in move_pauli_strings_into_circuit

3 participants