-
Notifications
You must be signed in to change notification settings - Fork 3
Cran fix release 1.3.0 #464
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
Changes from 9 commits
8671ab1
fd7bca0
8c58a2e
8892786
64e1181
3ac9d89
2fcf243
3e9da5d
17cd051
d7b32f8
6aca1ab
4fc1c9a
f313007
97262e0
19bfb26
c826098
ddaac35
842e296
428c6df
20a81c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #' Snapshot testing for [data.frame]s | ||
| #' @description | ||
| #' copied from <https://github.com/bcgov/ssdtools> | ||
| #' with permission (<https://github.com/bcgov/ssdtools/issues/379>) | ||
| #' | ||
| #' @param x a [data.frame] to snapshot | ||
| #' @param name [character] snapshot name | ||
| #' @param digits [integer] passed to [signif()] for numeric variables | ||
| #' | ||
| #' @returns [NULL] (from [testthat::expect_snapshot_file()]) | ||
| #' @export | ||
| #' @keywords internal | ||
| #' @examples | ||
| #' \dontrun{ | ||
| #' expect_snapshot_data(iris, name = "iris") | ||
| #' } | ||
| expect_snapshot_data <- function(x, name, digits = 6) { | ||
| fun <- function(x) signif(x, digits = digits) | ||
| lapply_fun <- function(x) I(lapply(x, fun)) | ||
| x <- dplyr::mutate(x, dplyr::across(tidyselect::where(is.numeric), fun)) | ||
| x <- dplyr::mutate(x, dplyr::across(tidyselect::where(is.list), lapply_fun)) | ||
| path <- save_csv(x) | ||
| testthat::expect_snapshot_file( | ||
| path, | ||
| paste0(name, ".csv"), | ||
| compare = testthat::compare_file_text | ||
| ) | ||
| } | ||
|
|
||
|
|
||
| save_csv <- function(x) { | ||
| path <- tempfile(fileext = ".csv") | ||
| readr::write_csv(x, path) | ||
| path | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,3 +123,5 @@ varepsilon | |
| vec | ||
| vee | ||
| yaml | ||
| mitre | ||
| colour | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,32 @@ | ||
| test_that("`ab()` works consistently", { | ||
|
|
||
| par1 <- matrix( | ||
| c( | ||
| 1.11418923843475, 1, 0.12415057798022207, 0.24829344792968783, | ||
| 0.01998946878312856, 0.0012360802436587237, 1.297194045996013, | ||
| 1.3976510415108334, 1, 0.2159993563893431, 0.4318070551383313, | ||
| 0.0015146395107173347, 0.0003580062906750277, 1.5695811573082081 | ||
| ), | ||
| nrow = 7L, | ||
| ncol = 2L, | ||
| dimnames = list( | ||
| params = c("y0", "b0", "mu0", "mu1", "c1", "alpha", "shape_r"), | ||
| antigen_iso = c("HlyE_IgA", "HlyE_IgG") | ||
| ) | ||
| ) | ||
| t <- 0:1444 | ||
| blims <- matrix( | ||
| rep(c(0, 0.5), each = 2L), | ||
| nrow = 2L, | ||
| ncol = 2L, | ||
| dimnames = list(c("HlyE_IgA", "HlyE_IgG"), c("min", "max")) | ||
| ) | ||
| preds <- ab(t = t, par = par1, blims = blims) | ||
| par1 <- matrix( | ||
| c( | ||
| 1.11418923843475, 1, 0.12415057798022207, 0.24829344792968783, | ||
| 0.01998946878312856, 0.0012360802436587237, 1.297194045996013, | ||
| 1.3976510415108334, 1, 0.2159993563893431, 0.4318070551383313, | ||
| 0.0015146395107173347, 0.0003580062906750277, 1.5695811573082081 | ||
| ), | ||
| nrow = 7L, | ||
| ncol = 2L, | ||
| dimnames = list( | ||
| params = c("y0", "b0", "mu0", "mu1", "c1", "alpha", "shape_r"), | ||
| antigen_iso = c("HlyE_IgA", "HlyE_IgG") | ||
| ) | ||
| ) | ||
| t <- 0:1444 | ||
| blims <- matrix( | ||
| rep(c(0, 0.5), each = 2L), | ||
| nrow = 2L, | ||
| ncol = 2L, | ||
| dimnames = list(c("HlyE_IgA", "HlyE_IgG"), c("min", "max")) | ||
| ) | ||
| preds <- ab(t = t, par = par1, blims = blims) | ||
|
|
||
| colnames(preds) <- colnames(par1) | ||
| colnames(preds) <- colnames(par1) | ||
|
|
||
| preds2 <- preds |> as_tibble() | ||
| preds2 <- preds |> as_tibble() | ||
|
|
||
| ssdtools:::expect_snapshot_data(preds2, name = "ab-preds") | ||
| expect_snapshot_data(preds2, name = "ab-preds") | ||
|
|
||
| }) |
Uh oh!
There was an error while loading. Please reload this page.