tests/testthat/test-group_by.R

test_that("nodes and edges are grouped", {
  gr <- create_notable('bull') %>%
    mutate(group = c(1,1,1,2,2)) %>%
    group_by(group)
  expect_s3_class(as_tibble(gr), 'grouped_df')
  expect_false(dplyr::is_grouped_df(as_tibble(gr, 'edges')))
  gr <- gr %>%
    activate(edges) %>%
    mutate(group = c(1,1,1,2,2)) %>%
    group_by(group)
  expect_s3_class(as_tibble(gr), 'grouped_df')
  expect_false(dplyr::is_grouped_df(as_tibble(gr, 'nodes')))
})

test_empty_context()

Try the tidygraph package in your browser

Any scripts or data that you put into this service are public.

tidygraph documentation built on June 22, 2024, 11:32 a.m.