Report offending input in register error messages - #1095
Open
jaewonyun1234 wants to merge 1 commit into
Open
Conversation
Adds the failing input to the 9 validation errors in base_register.py that previously stated only the rule, following the pattern from pasqal-io#1094. Existing message text is kept intact and details appended, so all match= assertions in tests/ continue to pass without modification. Also fixes a missing space in the label-length message, which rendered as 'does notmatch'. Partially addresses pasqal-io#1057.
Contributor
Author
|
Hi @a-corni ready for review whenever you have time. For the trap_ids bounds check I mentioned at the bottom — happy to fold a fix |
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.
Same as #1094, applied to
base_register.py.Nine messages updated:
__init__,_init_kwargs,find_indices,from_coordinates, four in_validate_layout, anddefine_detuning_map.Also fixed a missing space that printed as
Label length (3) does notmatch number of coordinates (2).I left
"Cannot create a Register with an empty qubit dictionary."alone. Thedictionary is empty, so there's nothing to print.
One thing I noticed:
trap_coords[trap_id]on line 229 isn't bounds checked, soa bad trap id gives a numpy error instead of a Pulser one.
RegisterLayout.define_registercatches this but theRegisterconstructorskips that check. I didn't fix it here since it changes behaviour, not wording.
Partially addresses #1057.