Skip to content

Commit 6165a89

Browse files
committed
fix: some borked tests
1 parent 42ea8ff commit 6165a89

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# expect error if `by` selector does not match
2+
3+
Code
4+
wf <- epi_workflow(r, parsnip::linear_reg()) %>% fit(jhu) %>% add_frosting(f)
5+
Condition
6+
Error in `hardhat::validate_column_names()`:
7+
! The following required columns are missing: 'a'.
8+
9+
---
10+
11+
Code
12+
forecast(wf)
13+
Condition
14+
Error in `hardhat::validate_column_names()`:
15+
! The following required columns are missing: 'nothere'.
16+

tests/testthat/_snaps/step_epi_slide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
r %>% step_epi_slide(value, .f = mean, .window_size = c(3L, 6L))
1313
Condition
1414
Error in `epiprocess:::validate_slide_window_arg()`:
15-
! Slide function expected `.window_size` to be a non-null, scalar integer >= 1.
15+
! Slide function expected `.window_size` to be a length-1 difftime with units in days or non-negative integer or Inf.
1616

1717
---
1818

@@ -60,7 +60,7 @@
6060
r %>% step_epi_slide(value, .f = mean, .window_size = 1.5)
6161
Condition
6262
Error in `epiprocess:::validate_slide_window_arg()`:
63-
! Slide function expected `.window_size` to be a difftime with units in days or non-negative integer or Inf.
63+
! Slide function expected `.window_size` to be a length-1 difftime with units in days or non-negative integer or Inf.
6464

6565
---
6666

tests/testthat/test-grf_quantiles.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ test_that("quantile_rand_forest defaults work", {
1010
expect_silent(out <- fit(spec, formula = y ~ x + z, data = tib))
1111
pars <- parsnip::extract_fit_engine(out)
1212
manual <- quantile_forest(as.matrix(tib[, 2:3]), tib$y, quantiles = c(0.1, 0.5, 0.9))
13-
expect_identical(pars$quantiles.orig, manual$quantiles)
13+
expect_identical(pars$quantiles.orig, manual$quantiles.orig)
1414
expect_identical(pars$`_num_trees`, manual$`_num_trees`)
1515

1616
fseed <- 12345

tests/testthat/test-snapshots.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ test_that("arx_forecaster output format snapshots", {
117117
jhu, "death_rate",
118118
c("case_rate", "death_rate")
119119
)
120-
expect_equal(as.Date(out1$metadata$forecast_created), Sys.Date())
120+
expect_equal(as.Date(format(out1$metadata$forecast_created, "%Y-%m-%d")), Sys.Date())
121121
out1$metadata$forecast_created <- as.Date("0999-01-01")
122122
expect_snapshot(out1)
123123
out2 <- arx_forecaster(jhu, "case_rate",
@@ -129,7 +129,7 @@ test_that("arx_forecaster output format snapshots", {
129129
forecast_date = as.Date("2022-01-03")
130130
)
131131
)
132-
expect_equal(as.Date(out2$metadata$forecast_created), Sys.Date())
132+
expect_equal(as.Date(format(out2$metadata$forecast_created, "%Y-%m-%d")), Sys.Date())
133133
out2$metadata$forecast_created <- as.Date("0999-01-01")
134134
expect_snapshot(out2)
135135
out3 <- arx_forecaster(jhu, "death_rate",
@@ -140,7 +140,7 @@ test_that("arx_forecaster output format snapshots", {
140140
forecast_date = as.Date("2022-01-03")
141141
)
142142
)
143-
expect_equal(as.Date(out3$metadata$forecast_created), Sys.Date())
143+
expect_equal(as.Date(format(out3$metadata$forecast_created, "%Y-%m-%d")), Sys.Date())
144144
out3$metadata$forecast_created <- as.Date("0999-01-01")
145145
expect_snapshot(out3)
146146
})

0 commit comments

Comments
 (0)