From ae844fb0df2260146c27e4fe1e3a6d7af3031f4a Mon Sep 17 00:00:00 2001 From: Danielle Callan Date: Tue, 30 Jan 2024 13:22:25 -0500 Subject: [PATCH] fix another case of poor use of isValidEdgeList --- R/constructors-Node.R | 4 ++-- tests/testthat/test-nodes.R | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) 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')) })