refactor: Tidy up how wildcards get expanded in testpoints#221
Open
rswarbrick wants to merge 1 commit into
Open
refactor: Tidy up how wildcards get expanded in testpoints#221rswarbrick wants to merge 1 commit into
rswarbrick wants to merge 1 commit into
Conversation
I think the existing implementation had a bit of a problem if you had multiple wildcard patterns that all expanded to lists of values. Presumably no-one ever cared, but it also wasn't very easy to see how the code worked. Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
0dcf943 to
a0dafb9
Compare
AlexJones0
approved these changes
May 21, 2026
|
|
||
| A wildcard use with no match in substitutions will be replaced by an | ||
| empty string (in a single item). For example, if substitutions is {} | ||
| and self.tests is ['test-{a}'] then self.tests will become ['test-']. |
Contributor
There was a problem hiding this comment.
Aside: the original implementation feels unintuitive - I feel like most similar systems would retain one copy of the unsubstituted text (i.e. just leave it as ['test-{a}']).
| ret.extend(Testpoint._expand_str(pattern, new_vals, txt)) | ||
| return ret | ||
|
|
||
| def do_substitutions(self, substitutions: dict, reserved_names: Sequence[str]) -> None: |
Contributor
There was a problem hiding this comment.
Can we make this substitutions: dict[str, str | list[str]] or is this too strong of a typing to enforce here at this stage? If not, at least substitutions: dict[str, Any]?
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.
I think the existing implementation had a bit of a problem if you had multiple wildcard patterns that all expanded to lists of values. Presumably no-one ever cared, but it also wasn't very easy to see how the code worked.