Skip to content
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

Replacing 'testthat' functions #2987 #3067

Merged
merged 43 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e1a02a5
Replacing testthat::expect_true with assert_that
Nov 15, 2022
738c741
Merge branch 'develop' into replace_testthat
Its-Maniaco Nov 15, 2022
d74af88
Replacing testthat::expect_true with assert_that
Nov 15, 2022
0a3ffe0
replaced testthat with logger
Nov 30, 2022
173242d
replaced testthat with logger
Nov 30, 2022
a5e2ffb
Update check_met_input.R
Its-Maniaco Nov 30, 2022
b3bd5db
Update check_met_input.R
Its-Maniaco Nov 30, 2022
c3a0e83
Replace testthat in test_dims function
Dec 13, 2022
eb7bb3f
Merge branch 'replace_testthat' of https://github.com/Its-Maniaco/pec…
Dec 13, 2022
af46b79
Moved testthat to Suggests
Dec 13, 2022
e26b17d
Merge branch 'develop' into replace_testthat
infotroph Jan 10, 2023
f05e0cd
Merge branch 'develop' into replace_testthat
Its-Maniaco Jan 17, 2023
288cab2
Merge branch 'develop' of https://github.com/Its-Maniaco/pecan into r…
Jan 18, 2023
8fdcb40
replaced validate_that with assert_that
Jan 18, 2023
bc3edc6
Merge branch 'replace_testthat' of https://github.com/Its-Maniaco/pec…
Jan 18, 2023
4a5636d
Merge branch 'develop' into replace_testthat
Aariq Jan 21, 2023
98340b5
Merge branch 'develop' into replace_testthat
infotroph Feb 6, 2023
fded356
Merge branch 'develop' into replace_testthat
Aariq Feb 10, 2023
feb3f08
Updated Documentation
Feb 12, 2023
e846223
Merge branch 'replace_testthat' of https://github.com/Its-Maniaco/pec…
Feb 12, 2023
f8a85ec
Update modules/data.atmosphere/DESCRIPTION
Its-Maniaco Feb 23, 2023
0cc7d6b
Merge branch 'develop' into replace_testthat
Its-Maniaco Feb 23, 2023
82382d0
Update modules/data.atmosphere/R/check_met_input.R
Aariq Mar 30, 2023
4698d61
Merge branch 'develop' into replace_testthat
Aariq Mar 30, 2023
15d12b8
Merge branch 'develop' into replace_testthat
infotroph Apr 5, 2023
f46c7ee
Merge branch 'develop' into replace_testthat
infotroph May 4, 2023
4d0fcd6
Merge branch 'develop' into replace_testthat
infotroph May 6, 2023
41eefc2
Merge branch 'develop' into replace_testthat
mdietze Jun 12, 2023
b2cee25
Merge branch 'develop' into replace_testthat
infotroph Nov 24, 2023
320eb1e
Merge branch 'PecanProject:develop' into replace_testthat
Its-Maniaco Dec 1, 2023
afa6a3b
Merge branch 'develop' into replace_testthat
infotroph Dec 2, 2023
793ae8b
Merge branch 'develop' into replace_testthat
infotroph Dec 23, 2023
eb65ede
Merge branch 'develop' into replace_testthat
mdietze Jan 18, 2024
9af94f6
Merge branch 'develop' into replace_testthat
infotroph Feb 21, 2024
45c9629
Merge branch 'develop' into replace_testthat
infotroph Mar 17, 2024
a86ac5c
Merge branch 'develop' into replace_testthat
infotroph Mar 26, 2024
8d80b9e
Merge branch 'develop' into replace_testthat
infotroph Apr 9, 2024
3272aa4
update deps
infotroph Apr 10, 2024
1963b3c
Merge branch 'develop' into replace_testthat
infotroph May 10, 2024
9f24aa4
simplify assertion logic to avoid try boilerplate
infotroph May 16, 2024
f2fa36d
Merge branch 'develop' into replace_testthat
infotroph May 16, 2024
ce38f80
these vars were defined twice
infotroph May 16, 2024
443c941
typo
infotroph May 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/data.atmosphere/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ Imports:
rlang (>= 0.2.0),
sp,
stringr (>= 1.1.0),
testthat (>= 2.0.0),
tibble,
tidyr,
tidyselect,
Expand All @@ -66,7 +65,8 @@ Suggests:
foreach,
parallel,
progress,
reticulate
reticulate,
testthat (>= 2.0.0)
Remotes:
github::chuhousen/amerifluxr,
github::ropensci/geonames,
Expand Down
25 changes: 14 additions & 11 deletions modules/data.atmosphere/R/check_met_input.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ check_met_input_file <- function(metfile,
"T[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}Z$"
)
test_dims <- list(
try2(testthat::expect_type(dimensions, "list")),
try2(testthat::expect_equal(length(dimensions), 3)),
try2(testthat::expect_true("time" %in% names(dimensions))),
try2(assertthat::validate_that(is.list(dimensions))),
try2(assertthat::are_equal(length(dimensions), 3)),
try2(assertthat::validate_that("time" %in% names(dimensions))),
try2(testthat::expect_match(
ncdf4::ncatt_get(nc, "time", "units")[["value"]],
time_regex
)),
try2(testthat::expect_true("latitude" %in% names(dimensions))),
try2(testthat::expect_equal(
try2(assertthat::validate_that("latitude" %in% names(dimensions))),
try2(assertthat::are_equal(
ncdf4::ncatt_get(nc, "latitude", "units")[["value"]],
"degrees_north"
)),
try2(testthat::expect_true("longitude" %in% names(dimensions))),
try2(testthat::expect_equal(
try2(assertthat::validate_that("longitude" %in% names(dimensions))),
try2(assertthat::are_equal(
ncdf4::ncatt_get(nc, "longitude", "units")[["value"]],
"degrees_east"
))
Aariq marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -118,8 +118,11 @@ check_unit <- function(variable, nc, variable_table, warn_unknown = TRUE) {
dplyr::filter(.data$cf_standard_name == variable) %>%
dplyr::pull(units)
ncvar_unit <- ncdf4::ncatt_get(nc, variable, "units")[["value"]]
try(testthat::expect_true(
PEcAn.utils::units_are_equivalent(ncvar_unit, var_correct_unit),
glue::glue("NetCDF unit '{ncvar_unit}' not equivalent to expected unit '{var_correct_unit}'.")
))

eq_units <- PEcAn.utils::units_are_equivalent(ncvar_unit, var_correct_unit)
if(!eq_units) {
PEcAn.logger::logger.error(
glue::glue("NetCDF unit '{ncvar_unit}' not equivalent to expected unit '{var_correct_unit}'.")
)
}
}