Skip to content
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

Better handling of typing.Optional #50

Merged
merged 13 commits into from
Sep 4, 2023
Merged

Better handling of typing.Optional #50

merged 13 commits into from
Sep 4, 2023

Conversation

SimonHeybrock
Copy link
Member

Fixes #40.

Should we add top-level docs for this?

def require_union(x: Union[int, float]) -> str:
return f'{x}'

pipeline = sl.Pipeline([require_union])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a provider for int and/or float so this actually tests something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, see update!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests where there is an optional and a required dependency on some value. And check that it works for any order or providers and whether the value can be provided or not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added one test, not entirely sure what the other cases you are asking for are.

@SimonHeybrock SimonHeybrock merged commit 451424c into main Sep 4, 2023
5 checks passed
@SimonHeybrock SimonHeybrock deleted the optional branch September 4, 2023 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handling of typing.Optional
2 participants