@@ -59,19 +59,20 @@ epi_tib <- epiprocess::new_epi_df(tib)
5959test_that(" grouped epi_df maintains type for select" , {
6060 grouped_epi <- epi_tib %> % group_by(geo_value )
6161 selected_df <- grouped_epi %> % select(- y )
62- expect_true(" epi_df" %in% class( selected_df ))
62+ expect_true(inherits( selected_df , " epi_df" ))
6363 # make sure that the attributes are right
6464 epi_attr <- attributes(selected_df )
6565 expect_identical(epi_attr $ names , c(" geo_value" , " time_value" , " x" ))
6666 expect_identical(epi_attr $ row.names , seq(1 , 10 ))
6767 expect_identical(epi_attr $ groups , attributes(grouped_epi )$ groups )
6868 expect_identical(epi_attr $ metadata , attributes(epi_tib )$ metadata )
69+ expect_identical(selected_df , epi_tib %> % select(- y ) %> % group_by(geo_value ))
6970})
7071
7172test_that(" grouped epi_df drops type when dropping keys" , {
7273 grouped_epi <- epi_tib %> % group_by(geo_value )
7374 selected_df <- grouped_epi %> % select(geo_value )
74- expect_true(! ( " epi_df" %in% class( selected_df ) ))
75+ expect_true(! inherits( selected_df , " epi_df" ))
7576})
7677
7778test_that(" grouped epi_df handles extra keys correctly" , {
@@ -91,17 +92,15 @@ test_that("grouped epi_df handles extra keys correctly", {
9192 attributes(epi_tib )
9293 grouped_epi <- epi_tib %> % group_by(geo_value )
9394 selected_df <- grouped_epi %> % select(- extra_key )
94- selected_df
95- expect_true(" epi_df" %in% class(selected_df ))
95+ expect_true(inherits(selected_df , " epi_df" ))
9696 # make sure that the attributes are right
9797 old_attr <- attributes(epi_tib )
9898 epi_attr <- attributes(selected_df )
9999 expect_identical(epi_attr $ names , c(" geo_value" , " time_value" , " x" , " y" ))
100100 expect_identical(epi_attr $ row.names , seq(1 , 10 ))
101101 expect_identical(epi_attr $ groups , attributes(grouped_epi )$ groups )
102102 expect_identical(epi_attr $ metadata , list (
103- geo_type = " state" , time_type =
104- " day" ,
103+ geo_type = " state" , time_type = " day" ,
105104 as_of = old_attr $ metadata $ as_of ,
106105 other_keys = character (0 )
107106 ))
0 commit comments