tests/testthat/test-parse_period.R

test_that("parse_period works", {
  expect_snapshot(error = TRUE, parse_period(c(1, 2)))
  expect_snapshot(error = TRUE, parse_period(c(1.3)))
  expect_snapshot(error = TRUE, parse_period("1 year"))
  expect_snapshot(error = TRUE, parse_period("2 weeks later"))
  expect_identical(parse_period(1), 1L)
  expect_identical(parse_period("1 day"), 1L)
  expect_identical(parse_period("1 days"), 1L)
  expect_identical(parse_period("1 week"), 7L)
  expect_identical(parse_period("1 weeks"), 7L)
  expect_identical(parse_period("2 weeks"), 14L)
})
cmu-delphi/epipredict documentation built on June 14, 2025, 2:41 a.m.