-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
top-level plot collections: fail on empty dict #10233
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10233 +/- ##
==========================================
- Coverage 90.47% 90.23% -0.25%
==========================================
Files 493 493
Lines 37595 37596 +1
Branches 5455 5455
==========================================
- Hits 34014 33924 -90
- Misses 2953 3022 +69
- Partials 628 650 +22 ☔ View full report in Codecov by Sentry. |
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 @skshetry for a quick turnaround and for empty YAML catch ...
- can we make it a validation error though? Otherwise it's easy to miss this kind of conditions
- I think we need a test for this ... it's easy to add and it's easy to get the same regression later in this (edge) case
Also, please add some description to PR :) |
There are just too many edge cases with schema and too many negative cases, that I don't find it worth it to cover it with tests. :) And the schema is very declarative. |
that's exactly what we need I think, especially as we hit more and more edge cases like this. It's totally fine to have 1000s of tests for this. And even consider generating different combinations, etc if needed. |
I'd look for property-based testing than writing 1000s of tests. |
Negative tests will just test |
I would argue that you are testing the DVC schema in this case (e.g. that someone would not drop the Required). But I agree if this is becomes part of the validation it's way better and less error prone. |
b91ff5d
to
3a82fba
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.
I would still add a test. Your call on this.
The problem here is that there is a mismatch between schema validation and parsing/deserialization. I don't think they are a different thing. They should be just one single thing. And we should just depend on validation to rule those edgecases out. |
* top-level plot collections: skip empty dict * tighten schema for plots; require key name
If you have a top-level plots with empty dict as follows:
dvc would fail with traceback that looks like:
The empty dict is not supported by dvc, and we should fail validation in this case.