-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix broken sample and add test for sample #1216
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
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
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
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.
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.
It might be worthwhile to update these tests to check that some labels were successfully returned, instead of a specific label (unless the docs specifically mention it should be detecting that label)
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.
Like switching the functions to return the result and then check if the size of returned labels are not 0?
I know that for ML APIs, I believe we still want to validate some of the results to make sure the results are accurate. But let me go double check.
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.
Just something to consider if the labels change a lot. Not blocking PR.
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.
Merging for now, will check with team on testing changes.
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.
+1 @kurtisvg Love the idea!
This came up in conversation only last week for testing responses from Machine Learning APIs based on models that can and do change over time
I love the idea of providing a list of test inputs/outputs and verifying that at least 1 of the assertions passed
It is very much à la Data Driven Tests aka Parameterized Tests
(see: JUnit4 Theories & other xUnit-style frameworks which implement 'Theories' for data-driven tests – C# xUnit Theory, Go Table-Driven-Tests, Python parameterized package, ...)
The main difference versus typical parameterized tests is that they usually exist to verify ALL SCENARIOS SUCCEED (versus any one of many scenarios succeed).
pseudocode example of parameterized tests
^--- rather than 1 test that asserts "Dog" is returned as a label when analyzing an image file, provide a LIST of input/outputs to test
And we want to assert at least one of the test cases passes
I love this. But I also want to be careful implementing it at this time. Because we have test-case consistency across 7 languages. When we start using this technique, I want to be clear about the expectations across languages. This also adds a new responsibility to the author of the canonical sample: rather than coming up with 1 test case, they will be tasked with coming up with multiple which should be stable over time – these should probably come from the product team.
#misc: I'm in the design phases of a generator for code sample tests (initially only for code samples that are generated as well) and this is one of my design requirements. I am backing in table/data-driven tests with the toggle option of either verifying that ALL SUCCESS (default) or ANY ONE SUCCEEDS (available option)