feat: extend assert_parameter with attribute checking#2
Open
bluefing wants to merge 1 commit intoDataBooth:mainfrom
Open
feat: extend assert_parameter with attribute checking#2bluefing wants to merge 1 commit intoDataBooth:mainfrom
bluefing wants to merge 1 commit intoDataBooth:mainfrom
Conversation
Adds **kwargs support to assert_parameter() so callers can verify parameter attributes (short, long, value, kind, help, pattern, etc.) in addition to checking existence. Backwards compatible — existing calls without kwargs continue to work unchanged.
Changed Files
|
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.
Extends
assert_parameter()with optional**kwargsfor verifying parameter attributes from the just dump payload.Changes
assert_parameter(recipe, param)— existing behaviour, checks parameter exists (unchanged)assert_parameter(recipe, param, short="i", long="interactive")— also checks attributesAny attribute present in the just dump can be checked:
short,long,value,kind,help,pattern,default,export. Unknown attributes raiseAssertionError.Backwards compatible — no changes needed for existing callers.
Tests
7 tests covering: individual attributes, combined attributes, missing parameter, wrong value, and unexpected attribute.