-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes for lcd and isd tests that also cache files
- Loading branch information
Showing
5 changed files
with
58 additions
and
97 deletions.
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
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,46 +1,43 @@ | ||
context("lcd") | ||
|
||
# FIXME: uncomment this test block when figure out writing to disk | ||
# tests alongside caching those files on disk | ||
|
||
# # clean up first | ||
# clean up first | ||
# lcd_cache$delete_all() | ||
|
||
# test_that("lcd", { | ||
# skip_on_cran() | ||
# skip_if_government_down() | ||
|
||
# vcr::use_cassette("lcd_1", { | ||
# aa <- lcd(station = "01338099999", year = 2017) | ||
# }) | ||
|
||
# expect_is(aa, "tbl_df") | ||
|
||
# expect_type(aa$station, 'integer') | ||
# expect_type(aa$date, 'character') | ||
# expect_type(aa$latitude, 'double') | ||
# expect_type(aa$longitude, 'double') | ||
# expect_type(aa$elevation, 'double') | ||
# expect_type(aa$hourlysealevelpressure, 'double') | ||
# }) | ||
|
||
# test_that("lcd fails well", { | ||
# skip_on_cran() | ||
# skip_if_government_down() | ||
|
||
# # a station/year combination that doesn't exist | ||
# vcr::use_cassette("lcd_not_found", { | ||
# expect_error(lcd(station = "02413099999", year = "1945"), | ||
# "Not Found", class = "error") | ||
# }) | ||
|
||
# # class | ||
# expect_error(lcd(5), | ||
# "\"year\" is missing, with no default") | ||
# expect_error(lcd(5, 5), | ||
# "year must be between 1901") | ||
# expect_error(lcd(list(1), 5), | ||
# "station must be of class") | ||
# expect_error(lcd(5, list(1)), | ||
# "year must be of class") | ||
# }) | ||
test_that("lcd", { | ||
skip_on_cran() | ||
skip_if_government_down() | ||
|
||
vcr::use_cassette("lcd_1", { | ||
aa <- lcd(station = "01338099999", year = 2017) | ||
}) | ||
|
||
expect_is(aa, "tbl_df") | ||
|
||
expect_type(aa$station, 'integer') | ||
expect_type(aa$date, 'character') | ||
expect_type(aa$latitude, 'double') | ||
expect_type(aa$longitude, 'double') | ||
expect_type(aa$elevation, 'double') | ||
expect_type(aa$hourlysealevelpressure, 'double') | ||
}) | ||
|
||
test_that("lcd fails well", { | ||
skip_on_cran() | ||
skip_if_government_down() | ||
|
||
# a station/year combination that doesn't exist | ||
vcr::use_cassette("lcd_not_found", { | ||
expect_error(lcd(station = "02413099999", year = "1945"), | ||
"Not Found", class = "error") | ||
}) | ||
|
||
# class | ||
expect_error(lcd(5), | ||
"\"year\" is missing, with no default") | ||
expect_error(lcd(5, 5), | ||
"year must be between 1901") | ||
expect_error(lcd(list(1), 5), | ||
"station must be of class") | ||
expect_error(lcd(5, list(1)), | ||
"year must be of class") | ||
}) |