Skip to content

Add tests for interval validation - #193

Merged
steffilazerte merged 1 commit into
ropensci:mainfrom
mahjabinoyshi:interval-tests-clean
Jan 19, 2026
Merged

Add tests for interval validation#193
steffilazerte merged 1 commit into
ropensci:mainfrom
mahjabinoyshi:interval-tests-clean

Conversation

@mahjabinoyshi

Copy link
Copy Markdown
Contributor

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

@steffilazerte

Copy link
Copy Markdown
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!

@mahjabinoyshi

mahjabinoyshi commented Jan 16, 2026

Copy link
Copy Markdown
Contributor Author

Hi, @steffilazerte

I’ve added myself to the DESCRIPTION file as a contributor in PR #197.
I noticed some CI checks failed, but since the Update-allcontributors step succeeded, my change should be fine.
Thank you again for your guidance and support!

@steffilazerte
steffilazerte merged commit fd8e866 into ropensci:main Jan 19, 2026
2 of 13 checks passed
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.

2 participants