File: test-github_issues.R

package info (click to toggle)
r-cran-intergraph 2.0-4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 392 kB
  • sloc: sh: 13; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 752 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# GitHub issue 1 ----------------------------------------------------------

test_that("NAs are preserved in edge attributes", {
  g <- igraph::graph( c(0,1, 1,2, 2,3, 3,4, 4,2)+1, directed=TRUE)
  igraph::E(g)$label <- c(1,2,3,NA,4)
  net <- asNetwork(g)
  expect_true(any( is.na(network::get.edge.attribute(net, "label"))))
  ig <- asIgraph(net)
  expect_true(any( is.na(igraph::edge_attr(ig, "label"))))
} )

test_that("NAs are preserved in vertex attributes", {
  g <- igraph::graph( c(0,1, 1,2, 2,3, 3,4, 4,2)+1, directed=TRUE)
  igraph::V(g)$label <- c(1,2,3,NA,4)
  net <- asNetwork(g)
  expect_true(any( is.na(network::get.vertex.attribute(net, "label"))))
  ig <- asIgraph(net)
  expect_true(any( is.na(igraph::vertex_attr(ig, "label"))))
} )