-
Notifications
You must be signed in to change notification settings - Fork 14
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
Implement DataValidator.apply()
#368
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
2db6a18
Remove empty line at end of file
danielhuppmann 17017e8
Make sure that validation-with-codelist passes if no criteria are given
danielhuppmann 31f7baa
Harmonize notation
danielhuppmann 402817d
Add `criteria` attribute
danielhuppmann 433415d
Add initial `apply` implementation
danielhuppmann 1dcfa11
Add a test for showing how to fail validation
danielhuppmann cb37ff3
Add a test for showing how to fail validation
danielhuppmann 8d3d822
Make black
danielhuppmann 68accb8
Write failing validation for each item to log with criteria
danielhuppmann 710497b
Don't add upper/lower bound columns explicitly
danielhuppmann b3288b9
Make more concise log error messages
danielhuppmann b190f96
Add a test
danielhuppmann 856a412
Fix failing test
danielhuppmann 766787e
Simplify test to one assertion
danielhuppmann 37f689a
Check if console-with is causing the problems
danielhuppmann a61b7c0
Fix validate data path
phackstock 7868fd5
Remove dev notebook
danielhuppmann 0f19b56
Implement review suggestion by @phackstock
danielhuppmann 9ae85dc
Remove unnecessary todo
danielhuppmann 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
This file contains 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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
- region: World | ||
variable: Final Energy | ||
- variable: Final Energy | ||
year: 2010 | ||
upper_bound: 2.5 | ||
lower_bound: 1 | ||
|
11 changes: 11 additions & 0 deletions
11
tests/data/validation/validate_data/validate_data_fails.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# 2005 value passes the validation, but the 2010 value does not | ||
- variable: Primary Energy | ||
upper_bound: 5. | ||
# variable exists only for 'scen_a' | ||
- variable: Primary Energy|Coal | ||
lower_bound: 2 | ||
# both upper and lower bound are triggered | ||
- variable: Primary Energy | ||
year: 2005 | ||
upper_bound: 1.9 | ||
lower_bound: 1.1 |
This file contains 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.
You could turn this into a single list comprehension and use the walrus operator:
not sure if that's more readable though.
Feel free to keep whatever is most readable to you.
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 seems less readable than the current implementation, so suggest to get it unless we make a utility-function that moves the string-concat somewhere else - maybe together with a refactor of the
RequiredDataValidator
?