Repository navigation
Conversation
ProgramSet only wrapped CircuitBinding and Program instances in a list, so a bare OpenQASM string was treated as a sequence and iterated character by character: ProgramSet(qasm) silently produced one single-character program per character of the source, with total_executables equal to len(qasm). A bare Circuit raised "TypeError: 'Circuit' object is not iterable". Both are already valid list entry types, and a standalone Program is already supported, so accept any single entry on its own.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1352 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 171 171
Lines 11648 11648
Branches 1538 1538
=========================================
Hits 11648 11648 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ProgramSet.__init__wraps onlyCircuitBindingandProgramin a list. A bare OpenQASM string is therefore treated as a sequence and iterated character by character, silently:No error is raised; the malformed program set is only caught at the service. A bare
Circuithits the same line and raisesTypeError: 'Circuit' object is not iterable.Both types are already valid list entries, and a standalone
Programis already supported (test_standalone_openqasm_program), so a standalone string or circuit is a natural thing to write.Fix
Include
Circuitandstrin theisinstancecheck that wraps a single entry, and widen the type hint/docstring accordingly.ProgramSet(qasm)now equalsProgramSet([qasm]), and a singleCircuitwith result types now raises the intendedValueError: Circuit cannot have result types.Verification
test_standalone_openqasm_stringandtest_standalone_circuit, mirroring the existingtest_standalone_openqasm_program. Both fail onmain(75-character split /TypeError) and pass with the fix.pytest test/unit_tests: 3492 passed, 131 xfailed.ruff check src,ruff format --check .,mypy: clean.entries,len,total_executables,total_shots,to_ir,enumerate_executables,split,__eq__,__add__on a standalone string and a standalone circuit, plus the unchangedCircuitBinding/Program/ mixed-list paths.AI disclosure: this PR was prepared with the assistance of Claude Code (Anthropic's Claude); I review and test all changes.