tests/testthat/test-serialize.R

test_that("serialization works", {
  local_igraph_options(print.id = FALSE)

  g <- make_ring(3, directed = TRUE)
  gs <- unserialize(serialize(g, NULL))

  expect_identical(unclass(g)[-igraph_t_idx_env], unclass(gs)[-igraph_t_idx_env])

  expect_snapshot({
    g
    gs
  })
})

Try the igraph package in your browser

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

igraph documentation built on Aug. 10, 2023, 9:08 a.m.