-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from WorldHealthOrganization/feature_dev
Feature dev
- Loading branch information
Showing
9 changed files
with
235 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,8 @@ Imports: | |
jsonlite, | ||
tidyselect, | ||
httpcode, | ||
tibble | ||
tibble, | ||
pbmcapply | ||
Suggests: | ||
testthat, | ||
withr, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,36 @@ | ||
testthat::test_that("Data types match correctly", { | ||
|
||
# set up sample ref target data | ||
ref_df <- tibble::tibble( | ||
integer_col = 1:3, | ||
character_col = c("a", "b", "c"), | ||
numeric_col = c(1.1, 2.2, 3.3), | ||
date_col = as.Date( | ||
c("2021-01-01", "2021-01-02", "2021-01-03")) | ||
) | ||
|
||
# set up sample target data | ||
target_df <- tibble::tibble( | ||
integer_col = c("1", "2", "3"), | ||
character_col = 1:3, | ||
numeric_col = c("1.1", "2.2", "3.3"), | ||
date_col = c("2021-01-01", "2021-01-02", "2021-01-03") | ||
) | ||
|
||
# match datatypes | ||
matched_df <- prep_match_datatypes(ref_df, target_df) | ||
|
||
# check if prep_match_datatypes works | ||
testthat::expect_type(matched_df$integer_col, "integer") | ||
testthat::expect_type(matched_df$character_col, "character") | ||
testthat::expect_type(matched_df$numeric_col, "double") | ||
testthat::expect_equal(class(matched_df$date_col), "Date") | ||
# set up sample ref target data | ||
ref_df <- tibble::tibble( | ||
integer_col = 1:3, | ||
character_col = c("a", "b", "c"), | ||
numeric_col = c(1.1, 2.2, 3.3), | ||
date_col = as.Date(c( | ||
"2021-01-01", "2021-01-02", "2021-01-03" | ||
)), | ||
posixct_date_col = as.POSIXct(c("2024-04-17", | ||
"2024-04-18", | ||
"2024-04-19"), | ||
format = "%Y-%m-%d") | ||
) | ||
|
||
# set up sample target data | ||
target_df <- tibble::tibble( | ||
integer_col = c("1", "2", "3"), | ||
character_col = 1:3, | ||
numeric_col = c("1.1", "2.2", "3.3"), | ||
date_col = c("2021-01-01", "2021-01-02", "2021-01-03"), | ||
posixct_date_col = c("2024-04-17", | ||
"2024-04-18", | ||
"2024-04-19") | ||
) | ||
|
||
# match datatypes | ||
matched_df <- prep_match_datatypes(ref_df, target_df) | ||
|
||
# check if prep_match_datatypes works | ||
testthat::expect_type(matched_df$integer_col, "integer") | ||
testthat::expect_type(matched_df$character_col, "character") | ||
testthat::expect_type(matched_df$numeric_col, "double") | ||
testthat::expect_equal(class(matched_df$date_col), "Date") | ||
#testthat::expect_equal(class(matched_df$posixct_date_col), 'c("POSIXct", "POSIXt")') | ||
}) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
test_that("multiplication works", { | ||
expect_equal(2 * 2, 4) | ||
}) |