hubverse-org / hubExamples

This package provides example data for forecasting and scenario modeling hubs in the hubverse format.
https://hubverse-org.github.io/hubExamples/
Other
1 stars 0 forks source link

move `raw-data/` tests inside of `raw-data/` script #34

Open zkamvar opened 3 weeks ago

zkamvar commented 3 weeks ago

in #33, a test suite was added to test the validity of the raw data. This is a good thing! The icky thing is the fact that the package tests were never really set up for this situation, which leads to things like getwd() sneaking into the code.

Given that these tests are designed to test the data generation and will only ever run locally, would it make more sense to move them inside of the script?

library(testthat)
library(dplyr)

## Data fetching and generation

test_that("data looks good", {
  expect_is(...)
})

test_that("data smells good", {
  expect_equal(...)
})

## Data writing and stuff.
annakrystalli commented 3 weeks ago

Just to add that if it is data integrity we are interested in, I.e. checking the data for certain characteristics before saving) then the assertr package might be more appropriate. https://docs.ropensci.org/assertr/

zkamvar commented 3 weeks ago

Oh yeah! assertr is fantastic. I've used it before in my analyses. I really like the feature where you can chain the assertions so that if you have multiple sources of failure, it will report all of them instead of just failing on the first one: https://docs.ropensci.org/assertr/articles/assertr.html?q=chain#combining-chains-of-assertions