Skip to content

Commit 9a3d950

Browse files
committed
pass local tests
1 parent cee786e commit 9a3d950

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

R/methods-epi_df.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ as_tibble.epi_df <- function(x, ...) {
1313
# grouping and should be called by `NextMethod()` in the current design.
1414
# See #223 for discussion of alternatives.
1515
if (attr(x, "no_decay_to_tibble") %||% FALSE) {
16-
return(ungroup(x))
16+
metadata <- attr(x, "metadata")
17+
x <- NextMethod()
18+
return(reclass(x, metadata))
1719
}
1820
decay_epi_df(NextMethod())
1921
}

tests/testthat/test-as_tibble-decay.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ test_that("as_tibble checks an attr to avoid decay to tibble", {
77

88
test_that("as_tibble ungroups if needed", {
99
edf <- jhu_csse_daily_subset %>% group_by(geo_value)
10-
expect_identical(class(as_tibble(edf)), c("tbl_df", "tbl", "data.frame"))
10+
# removes the grouped_df class
11+
expect_identical(class(as_tibble(edf)), c("tbl_df", "tbl", "data.frame"))
1112
attr(edf, "no_decay_to_tibble") <- TRUE
13+
# removes grouped_df but not `epi_df`
1214
expect_identical(class(as_tibble(edf)), c("epi_df", "tbl_df", "tbl", "data.frame"))
1315
})

0 commit comments

Comments
 (0)