-
Notifications
You must be signed in to change notification settings - Fork 16
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
json loading tests #425
json loading tests #425
Conversation
DataClass_obj$download_JSON() | ||
walk(DataClass_obj$data$raw, function(data) { | ||
testthat::expect_s3_class(data, "data.frame") | ||
testthat::expect_true(nrow(data) > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these tests (which are copied straight over from the CSV code) sort of implicitly assume that we are getting table-like inputs from JSON but even with the Vietnam data the clean method is having to do more “heavy lifting”, and that’s just because we’re getting three parallel lists of tables (roughly) with a list to tie them together. Conceivably we could have other JSON input which was even further from our rectangular array assumptions but still valid JSON, useful data, and convertible (by cleaning) into something the rest of our class can work with.
I don’t necessarily think this needs to be changed now but I could imagine a case where we have another input which generates valid raw data which fails this test - and I’ve already made the argument about why cleaning should be done in the clean methods so I’m inclined to keep the download functions from starting to squeeze data into our rectangular table straitjacket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes very much agree. Hmm that does leave us in a bit of a poser then regarding what to test. I suppose that lack of error and the existence of a JSON object as a minimum?
R/test-DataClass.R
Outdated
}) | ||
} | ||
) | ||
DataClass_obj$data$raw <- map(vn$data$raw, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will presumably fail if the input isn't a list of dataframes?
I think as written Not entirely sure what to do about this if we go with supporting non-datra frames as the output from download. I guess having a switch to only run tests if the output is a not JSON? |
I've just stepped through the |
commit 04009e7 Merge: d1630f5 68200f9 Author: Sam Abbott <[email protected]> Date: Wed Dec 1 14:27:05 2021 +0000 Merge pull request epiforecasts#443 from epiforecasts/feature-boostrap-5-in-docs Switch to bootstrap 5 for pkgdown commit 68200f9 Author: Sam Abbott <[email protected]> Date: Wed Dec 1 13:52:07 2021 +0000 switch to bootstrap 5 for pkgdown commit d1630f5 Merge: 71d7b1f ddbdb8e Author: Sam Abbott <[email protected]> Date: Wed Dec 1 13:48:12 2021 +0000 Merge pull request epiforecasts#442 from epiforecasts/fix-logo Fix giant logo by specifying width instead of height commit ddbdb8e Merge: a19643f 71d7b1f Author: Sam Abbott <[email protected]> Date: Wed Dec 1 13:47:52 2021 +0000 Merge branch 'master' into fix-logo commit a19643f Author: Hugo Gruson <[email protected]> Date: Wed Dec 1 14:30:11 2021 +0100 Fix giant logo by specifying width instead of height fix epiforecasts#440 commit 71d7b1f Merge: 2e5cabc fb10488 Author: Sam Abbott <[email protected]> Date: Wed Dec 1 10:21:14 2021 +0000 Merge pull request epiforecasts#438 from epiforecasts/rm-joss-action Remove action re-building JOSS paper commit fb10488 Author: Hugo Gruson <[email protected]> Date: Tue Nov 30 19:09:00 2021 +0100 Remove action re-building JOSS paper commit 2e5cabc Author: Sam Abbott <[email protected]> Date: Mon Nov 29 13:43:29 2021 +0000 Update NEWS.md commit d1350d9 Merge: 8c77b82 782256c Author: Sam Abbott <[email protected]> Date: Mon Nov 29 13:41:00 2021 +0000 Merge pull request epiforecasts#436 from epiforecasts/fix-germany fix Germany case/death data commit 782256c Author: Sebastian Funk <[email protected]> Date: Mon Nov 29 07:40:01 2021 +0000 add missing sum commit 4c7cb8c Author: Sebastian Funk <[email protected]> Date: Mon Nov 29 07:19:09 2021 +0000 fix Germany case/death data commit 8c77b82 Author: Sam Abbott <[email protected]> Date: Tue Oct 12 10:20:55 2021 +0100 Check package once a week vs daily commit b5b9cbf Merge: c782b57 91d0f0c Author: Sam Abbott <[email protected]> Date: Thu Sep 30 13:01:56 2021 +0100 Merge pull request epiforecasts#428 from RichardMN/update-Vietnam-url-and-docs Update vietnam url and docs commit 91d0f0c Author: Richard Martin-Nielsen <[email protected]> Date: Thu Sep 30 09:12:37 2021 +0300 Rebuilt all country data table and Vietnam documentation commit 1d6c024 Author: Tri Luu <[email protected]> Date: Thu Sep 30 09:38:37 2021 +0700 Update stable API URL of Vietnam
This PR has been flagged as stale due to lack of activity |
This is currently a WIP to address #420.