New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for illegal inputs #161
Conversation
❌ Build rotest 1.0.1368 failed (commit 09f48688e5 by @UnDarkle) |
❌ Build rotest 1.0.1370 failed (commit 4b1d12fa29 by @UnDarkle) |
src/rotest/core/block.py
Outdated
@@ -174,3 +176,15 @@ def validate_inputs(self, extra_inputs=[]): | |||
raise AttributeError("Block %r under %r is missing mandatory " | |||
"inputs %s" % | |||
(self.data.name, self.parent, missing_inputs)) | |||
|
|||
def _is_valid_input(self, parameter_name): | |||
"""Check if the given parameter is a valid inputs for the component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*input
src/rotest/core/flow_component.py
Outdated
"""Inject parameters into the component. | ||
|
||
Args: | ||
override_previous (bool): whether to override previous value of | ||
the parameters if they were already injected or not. | ||
validate_unknown (bool): check that all the parameters are legal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer just "all parameters are legal"
src/rotest/core/flow_component.py
Outdated
""" | ||
# The 'mode' parameter is only relevant to the current hierarchy | ||
setattr(self, 'mode', parameters.pop('mode', self.mode)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do self.mode = ...
No?
src/rotest/core/flow_component.py
Outdated
@@ -430,6 +435,18 @@ def _set_parameters(self, override_previous=True, **parameters): | |||
else: | |||
setattr(self, name, value) | |||
|
|||
if validate_unknown and not self._is_valid_input(name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better naming it validate_unknown_inputs
for clearer intentions
src/rotest/core/flow_component.py
Outdated
Args: | ||
parameter_name (str): parameter name to compare with input names. | ||
""" | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raise NotImplementedError
❌ Build rotest 1.0.1372 failed (commit 43b2a8ce0c by @gregoil) |
No description provided.