-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
test(sdk): add test for local execution of None
default parameter #localexecution
#10339
test(sdk): add test for local execution of None
default parameter #localexecution
#10339
Conversation
Skipping CI for Draft Pull Request. |
None
default parameter #localexecution
5988bae
to
ece1692
Compare
/assign @chensun |
output_parameters[float_output_key] = int( | ||
output_parameters[float_output_key]) | ||
for int_output_key in int_output_keys: | ||
# avoid KeyError when the user never writes to the dsl.OutputPath |
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.
#10338 should be merged into the same PR then, so the fix and test are together.
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.
Thanks. My mistake. This was my rebase error; I included this file in the wrong PR. Fixed now.
|
||
@dsl.component | ||
def my_comp(string: Optional[str] = None): | ||
assert string is None |
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.
This component by itself is wrong--the input parameter cannot accept any other input values.
I think a more proper way to test optional default value would be move assert outside component implementation:
@dsl.component
def my_comp(string: Optional[str] = None) -> str:
return 'default' if string is None else 'non-default'
task = my_comp()
self.assertEqual(task.outputs, 'default')
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.
Agreed. Fixed.
ece1692
to
08c73e0
Compare
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.
/lgtm
/approve
thanks!
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.
Thanks for the good catches. Will wait to merge until after #10338 to avoid competing changes.
|
||
@dsl.component | ||
def my_comp(string: Optional[str] = None): | ||
assert string is None |
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.
Agreed. Fixed.
output_parameters[float_output_key] = int( | ||
output_parameters[float_output_key]) | ||
for int_output_key in int_output_keys: | ||
# avoid KeyError when the user never writes to the dsl.OutputPath |
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.
Thanks. My mistake. This was my rebase error; I included this file in the wrong PR. Fixed now.
/retest |
08c73e0
to
fcbde55
Compare
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chensun The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
5994bf0
to
69ed490
Compare
69ed490
to
348bf7a
Compare
348bf7a
to
4c56b53
Compare
@connor-mccarthy: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
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.
/lgtm
Description of your changes:
Adds a test for local execution of optional parameters (e.g.,
my_comp(x: Optional[str] = None)
.Checklist: