Skip to content

Commit ec4756c

Browse files
authored
Fewer snapshots in testing (#72)
* use saved objects instead of snapshots for #71 * use saved objects instead of snapshots * rlang version requirement * use saved objects instead of snapshots, binary mlp edition * use saved objects instead of snapshots, mulitclass mlp edition * use saved objects instead of snapshots, regression mlp edition * try testing on other OS * updated multinom snapshot * regenerate test objects based on changes from #70 * remove model print snapshots since they are not reproducible * try running on all os * add back skip for apple silicon * update skips * more skip updates
1 parent 7f7a421 commit ec4756c

33 files changed

+965
-939
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ Imports:
2222
ggplot2,
2323
glue,
2424
hardhat,
25-
rlang,
25+
rlang (>= 1.1.1),
2626
stats,
2727
tibble,
28-
torch (>= 0.6.0),
28+
torch (>= 0.11.0),
2929
utils
3030
Suggests:
3131
covr,

tests/testthat/_snaps/logistic_reg-fit.md

Lines changed: 0 additions & 59 deletions
This file was deleted.

tests/testthat/_snaps/mlp-binary.md

Lines changed: 0 additions & 91 deletions
This file was deleted.

tests/testthat/_snaps/mlp-multinomial.md

Lines changed: 0 additions & 70 deletions
This file was deleted.

tests/testthat/_snaps/mlp-regression.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/testthat/_snaps/multinomial_reg-fit.md

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
last_param <- function(x) {
2+
last_epoch <- length(x$loss)
3+
coef(x, epoch = last_epoch)
4+
}
5+
6+
save_coef <- function(x) {
7+
cl <- match.call()
8+
nm <- as.character(cl$x)
9+
fl <- file.path("saved", paste0(nm, ".rds"))
10+
if (file.exists(fl)) {
11+
return(FALSE)
12+
}
13+
res <- last_param(x)
14+
saveRDS(res, file = fl)
15+
invisible(TRUE)
16+
}
17+
18+
load_coef <- function(x) {
19+
cl <- match.call()
20+
nm <- as.character(cl$x)
21+
fl <- file.path("saved", paste0(nm, ".rds"))
22+
if (!file.exists(fl)) {
23+
rlang::abort(paste("Can't find test results:", fl))
24+
}
25+
readRDS(fl)
26+
}
27+
114 Bytes
Binary file not shown.
114 Bytes
Binary file not shown.
114 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)