|
1 | 1 | test_that("as_tibble checks an attr to avoid decay to tibble", {
|
2 | 2 | edf <- jhu_csse_daily_subset
|
3 | 3 | expect_identical(class(as_tibble(edf)), c("tbl_df", "tbl", "data.frame"))
|
4 |
| - attr(edf, "no_decay_to_tibble") <- TRUE |
| 4 | + attr(edf, "decay_to_tibble") <- TRUE |
| 5 | + expect_identical(class(as_tibble(edf)), c("tbl_df", "tbl", "data.frame")) |
| 6 | + attr(edf, "decay_to_tibble") <- FALSE |
5 | 7 | expect_identical(class(as_tibble(edf)), c("epi_df", "tbl_df", "tbl", "data.frame"))
|
6 | 8 | })
|
7 | 9 |
|
8 | 10 | test_that("as_tibble ungroups if needed", {
|
9 | 11 | edf <- jhu_csse_daily_subset %>% group_by(geo_value)
|
10 | 12 | # removes the grouped_df class
|
11 |
| - expect_identical(class(as_tibble(edf)), c("tbl_df", "tbl", "data.frame")) |
12 |
| - attr(edf, "no_decay_to_tibble") <- TRUE |
| 13 | + expect_identical(class(as_tibble(edf)), c("tbl_df", "tbl", "data.frame")) |
| 14 | + attr(edf, "decay_to_tibble") <- TRUE |
| 15 | + expect_identical(class(as_tibble(edf)), c("tbl_df", "tbl", "data.frame")) |
| 16 | + attr(edf, "decay_to_tibble") <- FALSE |
13 | 17 | # removes grouped_df but not `epi_df`
|
14 | 18 | expect_identical(class(as_tibble(edf)), c("epi_df", "tbl_df", "tbl", "data.frame"))
|
15 | 19 | })
|
0 commit comments