Add tests for interval validation - #193
Merged
Merged
Conversation
Member
|
Hi @mahjabinoyshi, thank you for your contribution! I've been trying to figure out why all the tests are failing and I realized that it's because ECCC I think has reverted the changes they made a couple of weeks ago 🤦🏼. So I'll see about fixing that next week (your tests have no problem 😁). In the meanwhile, could you add yourself as a contributor to the DESCRIPTION file? You'll see other contributors there for reference. Thanks again! |
Contributor
Author
|
Hi, @steffilazerte I’ve added myself to the DESCRIPTION file as a contributor in PR #197. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This pull request adds a new test file called tests/testthat/test-interval-validation.R. The file checks the interval argument. The tests make sure that stations_search() and weather_interp() give errors if the interval value is not supported. They check that using interval = "year" or interval = c("day", "month") causes errors. Only "hour", "day", and "month" are allowed.
Related Issue
This work adds tests for wrong interval values in stations_search() and weather_interp(). It supports the discussion in issue #166. It does not change how the functions work. It only adds tests to cover the current checks.
Example
For example, the new tests expect:
stations_search(interval = "year") and stations_search(interval = c("day", "month")) both give an error that the interval is invalid.
weather_interp(interval = "year") and weather_interp(interval = c("day", "month")) also give errors for wrong interval values.
These tests are in the new testthat file. They run with the other tests automatically.
Best Practices
We updated or added the following as needed:
[ ] Documentation
[ ] Examples in documentation
[ ] Vignettes
[x] testthat Tests