Skip to content
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

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

Open
zkamvar opened this issue Sep 18, 2024 · 2 comments
Open

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

zkamvar opened this issue Sep 18, 2024 · 2 comments

Comments

@zkamvar
Copy link
Member

zkamvar commented Sep 18, 2024

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
Copy link
Member

annakrystalli commented Sep 20, 2024

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
Copy link
Member Author

zkamvar commented Sep 20, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants