diff --git a/R/constructors-Node.R b/R/constructors-Node.R index 743dbb6..9b7a147 100644 --- a/R/constructors-Node.R +++ b/R/constructors-Node.R @@ -71,8 +71,8 @@ setMethod("NodeIdList", "character", function(object, uniquifyIds = c(TRUE, FALS #' @export setMethod("NodeIdList", "data.frame", function(object, uniquifyIds = c(TRUE, FALSE)) { - if (!isValidEdgeList(object)) { - stop(paste(errors, collapse = '\n')) + if (!inherits(isValidEdgeList(object), "logical")) { + stop(paste("Invalid edgeList:", isValidEdgeList(object), collapse = '\n')) } return(NodeIdList(c(object$source, object$target), uniquifyIds = uniquifyIds)) diff --git a/tests/testthat/test-nodes.R b/tests/testthat/test-nodes.R index 122a5de..5e4034c 100644 --- a/tests/testthat/test-nodes.R +++ b/tests/testthat/test-nodes.R @@ -84,7 +84,6 @@ test_that("NodeList methods work", { test_that("We cannot make nonsensical nodes", { expect_error(Node(id = FALSE)) - #expect_error(Node(id = 10)) # why is this nonsensical? expect_error(Node(id = 'A', color = FALSE)) expect_error(Node(id = 'A', weight = '10')) })