Skip to content

Commit

Permalink
test processing reversion
Browse files Browse the repository at this point in the history
  • Loading branch information
seabbs committed Feb 5, 2022
1 parent ee41f59 commit ffdd364
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
9 changes: 4 additions & 5 deletions R/processing.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ process_internal <- function(clean_data, level, group_vars,
group_vars_standard, "cases_total", "deaths_total", "recovered_total",
"hosp_total", "tested_total"
)
)) %>%
ungroup()
))
} else {
dat <- dat %>%
drop_na(.data$date) %>%
Expand All @@ -264,11 +263,11 @@ process_internal <- function(clean_data, level, group_vars,
"hosp_new", "hosp_total", "tested_new", "tested_total"
)),
everything()
) %>%
ungroup() %>%
arrange(.data$date, all_of(group_vars_standard[1]))
)
}

dat <- ungroup(dat)

if (localise) {
old <- names(group_vars)
names(old) <- group_vars
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/custom_tests/mock_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ get_expected_data_for_complete_cumulative_columns_test <- function() {

# manually add cumulative cases to get expected data
full_data_with_cum_cases_filled <- partial_data %>%
dplyr::group_by(level_1_region, level_1_region_code) %>%
covidregionaldata:::fill_empty_dates_with_na()
full_data_with_cum_cases_filled <-
dplyr::arrange(full_data_with_cum_cases_filled, level_1_region, date)
Expand Down
7 changes: 3 additions & 4 deletions tests/testthat/test-processing.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,12 @@ test_that("fill_empty_dates_with_na fills empty dates with NA", {
expected_data <- get_expected_data_for_fill_empty_dates_with_na_test()
# partial data deletes some rows (i.e. gets rid of some dates - all the ones
# with NA in cases)
expected_data <- expected_data %>%
dplyr::group_by(level_1_region, level_1_region_code)
expected_data <- expected_data

partial_data <- expected_data[-c(6:9), ]
expect_equal(
fill_empty_dates_with_na(partial_data),
dplyr::arrange(expected_data, level_1_region, date)
expected_data
)
expected_data <- dplyr::mutate(
expected_data,
Expand All @@ -101,7 +100,7 @@ test_that("fill_empty_dates_with_na fills empty dates with NA", {
partial_data <- expected_data[-c(6:9), ]
expect_equal(
fill_empty_dates_with_na(partial_data),
dplyr::arrange(expected_data, level_2_region, date)
expected_data
)
})

Expand Down

0 comments on commit ffdd364

Please sign in to comment.