diff --git a/tests/test-networks-artifact.R b/tests/test-networks-artifact.R index 1d847b54..56300d5a 100644 --- a/tests/test-networks-artifact.R +++ b/tests/test-networks-artifact.R @@ -57,6 +57,7 @@ test_that("Network construction of the undirected artifact-cochange network", { ) ## 3) build expected network network.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices) + network.expected = convert.edge.attributes.to.list(network.expected) ## @@ -158,6 +159,7 @@ patrick::with_parameters_test_that("Network construction of an issue-based artif ## build expected network network.expected = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices) + network.expected = convert.edge.attributes.to.list(network.expected) ## build network network.built = network.builder$get.artifact.network() @@ -207,6 +209,7 @@ patrick::with_parameters_test_that("Network construction of an empty 'comments-o ## build expected network network.expected = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices) + network.expected = convert.edge.attributes.to.list(network.expected) ## test assert.networks.equal(network.built, network.expected) @@ -258,6 +261,7 @@ patrick::with_parameters_test_that("Network construction with commit-interaction relation = c("commit.interaction", "commit.interaction", "commit.interaction", "commit.interaction") ) network = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices) + network = convert.edge.attributes.to.list(network) expect_true(igraph::identical_graphs(network.built, network)) }, patrick::cases( @@ -308,6 +312,7 @@ patrick::with_parameters_test_that("Network construction with commit-interaction relation = c("commit.interaction", "commit.interaction", "commit.interaction", "commit.interaction") ) network = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices) + network = convert.edge.attributes.to.list(network) expect_true(igraph::identical_graphs(network.built, network)) }, patrick::cases( diff --git a/tests/test-networks-author.R b/tests/test-networks-author.R index d343a0c5..43fb347f 100644 --- a/tests/test-networks-author.R +++ b/tests/test-networks-author.R @@ -232,6 +232,7 @@ test_that("Network construction of the undirected author-cochange network", { ) ## 3) build expected network network.expected = igraph::graph_from_data_frame(data, directed = FALSE, vertices = authors) + network.expected = convert.edge.attributes.to.list(network.expected) ## @@ -316,6 +317,7 @@ test_that("Network construction of the undirected but temorally ordered author-c ## build expected network network.expected = igraph::graph_from_data_frame(data, directed = FALSE, vertices = authors) + network.expected = convert.edge.attributes.to.list(network.expected) expect_true(igraph::identical_graphs(network.built, network.expected)) }) @@ -357,6 +359,7 @@ test_that("Network construction of the directed author-cochange network", { ## build expected network network.expected = igraph::graph_from_data_frame(data, directed = TRUE, vertices = authors) + network.expected = convert.edge.attributes.to.list(network.expected) expect_true(igraph::identical_graphs(network.built, network.expected)) }) @@ -403,6 +406,7 @@ test_that("Network construction of the directed author-cochange network without ## build expected network network.expected = igraph::graph_from_data_frame(data, directed = TRUE, vertices = authors) + network.expected = convert.edge.attributes.to.list(network.expected) expect_true(igraph::identical_graphs(network.built, network.expected)) }) @@ -431,25 +435,26 @@ test_that("Network construction of the undirected simplified author-cochange net date.attr = igraph::edge_attr(network.built, "date") date.conversion.function = ifelse(all(sapply(date.attr, lubridate::is.POSIXct)), get.date.from.unix.timestamp, identity) + date.conversion.function = get.date.from.unix.timestamp ## edge attributes data = data.frame( from = c("Björn", "Olaf", "Olaf", "Karl"), to = c("Olaf", "Karl", "Thomas", "Thomas"), - date = I(list(date.conversion.function(c(1468339139, 1468339245)), - date.conversion.function(c(1468339541, 1468339570)), - date.conversion.function(c(1468339541, 1468339592)), - date.conversion.function(c(1468339570, 1468339592)))), - artifact.type = I(list(c("Feature", "Feature"), c("Feature", "Feature"), c("Feature", "Feature"), - c("Feature", "Feature"))), + date = I(list(as.list(date.conversion.function(c(1468339139, 1468339245))), + as.list(date.conversion.function(c(1468339541, 1468339570))), + as.list(date.conversion.function(c(1468339541, 1468339592))), + as.list(date.conversion.function(c(1468339570, 1468339592))))), + artifact.type = I(list(list("Feature", "Feature"), list("Feature", "Feature"), list("Feature", "Feature"), + list("Feature", "Feature"))), hash = I(list( - c("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "5a5ec9675e98187e1e92561e1888aa6f04faa338"), - c("3a0ed78458b3976243db6829f63eba3eead26774", "1143db502761379c2bfcecc2007fc34282e7ee61"), - c("3a0ed78458b3976243db6829f63eba3eead26774", "0a1a5c523d835459c42f33e863623138555e2526"), - c("1143db502761379c2bfcecc2007fc34282e7ee61", "0a1a5c523d835459c42f33e863623138555e2526"))), - file = I(list(c("test.c", "test.c"), c("test2.c", "test3.c"), c("test2.c", "test2.c"), c("test3.c", "test2.c"))), - artifact = I(list(c("A", "A"), c("Base_Feature", "Base_Feature"), c("Base_Feature", "Base_Feature"), - c("Base_Feature", "Base_Feature"))), + list("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "5a5ec9675e98187e1e92561e1888aa6f04faa338"), + list("3a0ed78458b3976243db6829f63eba3eead26774", "1143db502761379c2bfcecc2007fc34282e7ee61"), + list("3a0ed78458b3976243db6829f63eba3eead26774", "0a1a5c523d835459c42f33e863623138555e2526"), + list("1143db502761379c2bfcecc2007fc34282e7ee61", "0a1a5c523d835459c42f33e863623138555e2526"))), + file = I(list(list("test.c", "test.c"), list("test2.c", "test3.c"), list("test2.c", "test2.c"), list("test3.c", "test2.c"))), + artifact = I(list(list("A", "A"), list("Base_Feature", "Base_Feature"), list("Base_Feature", "Base_Feature"), + list("Base_Feature", "Base_Feature"))), weight = 2, type = TYPE.EDGES.INTRA, relation = "cochange" @@ -589,6 +594,7 @@ test_that("Network construction of the undirected author-issue network with all ## build expected network network.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices) + network.expected = convert.edge.attributes.to.list(network.expected) expect_true(igraph::identical_graphs(network.built, network.expected)) }) @@ -649,6 +655,7 @@ test_that("Network construction of the undirected author-issue network with just ## build expected network network.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices) + network.expected = convert.edge.attributes.to.list(network.expected) expect_true(igraph::identical_graphs(network.built, network.expected)) }) @@ -677,6 +684,7 @@ test_that("Network construction with only untracked files (no edges expected)", vertices = list(name = c("Karl", "Thomas"), kind = TYPE.AUTHOR, type = TYPE.AUTHOR) network.expected = create.empty.network(directed = FALSE, add.attributes = TRUE) network.expected = igraph::add_vertices(network.expected, nv = max(lengths(vertices)), attr = vertices) + network.expected = convert.edge.attributes.to.list(network.expected) ## test expect_true(igraph::identical_graphs(network.built, network.expected)) @@ -726,6 +734,7 @@ patrick::with_parameters_test_that("Network construction with commit-interaction relation = c("commit.interaction", "commit.interaction", "commit.interaction", "commit.interaction") ) network = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices) + network = convert.edge.attributes.to.list(network) expect_true(igraph::identical_graphs(network.built, network)) }, patrick::cases( diff --git a/tests/test-networks-bipartite.R b/tests/test-networks-bipartite.R index c6725281..3c6fd3b4 100644 --- a/tests/test-networks-bipartite.R +++ b/tests/test-networks-bipartite.R @@ -84,6 +84,7 @@ test_that("Construction of the bipartite network for the feature artifact with a ## 3) construct expected network network.expected = igraph::graph_from_data_frame(network.expected.data, vertices = vertices, directed = net.conf$get.value("author.directed")) + network.expected = convert.edge.attributes.to.list(network.expected) expect_true(igraph::identical_graphs(network.built, network.expected)) }) @@ -137,6 +138,7 @@ test_that("Construction of the bipartite network for the file artifact with auth ## 3) construct expected network network.expected = igraph::graph_from_data_frame(network.expected.data, vertices = vertices, directed = net.conf$get.value("author.directed")) + network.expected = convert.edge.attributes.to.list(network.expected) expect_true(igraph::identical_graphs(network.built, network.expected)) }) @@ -189,6 +191,7 @@ test_that("Construction of the bipartite network for the function artifact with ) ## 3) construct expected network network.expected = igraph::graph_from_data_frame(network.expected.data, directed = net.conf$get.value("author.directed"), vertices = vertices) + network.expected = convert.edge.attributes.to.list(network.expected) expect_true(igraph::identical_graphs(network.built, network.expected)) }) @@ -240,6 +243,7 @@ test_that("Construction of the bipartite network for the featureexpression artif ## 3) construct expected network network.expected = igraph::graph_from_data_frame(network.expected.data, vertices = vertices, directed = net.conf$get.value("author.directed")) + network.expected = convert.edge.attributes.to.list(network.expected) expect_true(igraph::identical_graphs(network.built, network.expected)) }) @@ -309,6 +313,7 @@ test_that("Construction of the bipartite network for the feature artifact with a ) ## 3) construct expected network network.expected = igraph::graph_from_data_frame(network.expected.data, directed = net.conf$get.value("author.directed"), vertices = vertices) + network.expected = convert.edge.attributes.to.list(network.expected) expect_true(igraph::identical_graphs(network.built, network.expected)) }) @@ -362,6 +367,7 @@ test_that("Construction of the directed bipartite network for the feature artifa ## 3) construct expected network network.expected = igraph::graph_from_data_frame(network.expected.data, vertices = vertices, directed = net.conf$get.value("author.directed")) + network.expected = convert.edge.attributes.to.list(network.expected) expect_true(igraph::identical_graphs(network.built, network.expected)) }) @@ -415,6 +421,7 @@ test_that("Construction of the directed bipartite network for the file artifact ## 3) construct expected network network.expected = igraph::graph_from_data_frame(network.expected.data, vertices = vertices, directed = net.conf$get.value("author.directed")) + network.expected = convert.edge.attributes.to.list(network.expected) expect_true(igraph::identical_graphs(network.built, network.expected)) }) @@ -469,6 +476,7 @@ test_that("Construction of the directed bipartite network for the function artif ## 3) construct expected network network.expected = igraph::graph_from_data_frame(network.expected.data, vertices = vertices, directed = net.conf$get.value("author.directed")) + network.expected = convert.edge.attributes.to.list(network.expected) expect_true(igraph::identical_graphs(network.built, network.expected)) }) @@ -521,6 +529,7 @@ test_that("Construction of the directed bipartite network for the featureexpress ## 3) construct expected network network.expected = igraph::graph_from_data_frame(network.expected.data, vertices = vertices, directed = net.conf$get.value("author.directed")) + network.expected = convert.edge.attributes.to.list(network.expected) expect_true(igraph::identical_graphs(network.built, network.expected)) }) @@ -563,6 +572,7 @@ test_that("Network construction with only untracked files (no edges and artifact directed = net.conf$get.value("author.directed")) ## 4) remove edge again network.expected = igraph::delete_edges(network.expected, 1) + network.expected = convert.edge.attributes.to.list(network.expected) ## test expect_true(igraph::identical_graphs(network.built, network.expected)) diff --git a/tests/test-networks-commit.R b/tests/test-networks-commit.R index b992846e..e5c39672 100644 --- a/tests/test-networks-commit.R +++ b/tests/test-networks-commit.R @@ -83,6 +83,7 @@ patrick::with_parameters_test_that("Network construction with commit-interaction relation = c("commit.interaction", "commit.interaction", "commit.interaction", "commit.interaction") ) network = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices) + network = convert.edge.attributes.to.list(network) expect_true(igraph::identical_graphs(network.built, network)) network.new.attr = add.vertex.attribute.commit.network(network.built, proj.data, "deleted.lines", "NO_DATA") @@ -133,6 +134,7 @@ patrick::with_parameters_test_that("Network construction with cochange as relati edges <- edges[, c(2, 1, 3, 4, 5, 6, 7, 8), ] } network = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices) + network = convert.edge.attributes.to.list(network) expect_true(igraph::identical_graphs(network.built, network)) }, patrick::cases( @@ -188,6 +190,7 @@ patrick::with_parameters_test_that("Network construction with cochange as relati edges <- edges[, c(2, 1, 3, 4, 5, 6, 7, 8), ] } network = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices) + network = convert.edge.attributes.to.list(network) expect_true(igraph::identical_graphs(network.built, network)) }, patrick::cases( @@ -239,6 +242,7 @@ patrick::with_parameters_test_that("Network construction with cochange as relati edges <- edges[, c(2, 1, 3, 4, 5, 6, 7, 8), ] } network = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices) + network = convert.edge.attributes.to.list(network) expect_true(igraph::identical_graphs(network.built, network)) }, patrick::cases( @@ -293,6 +297,7 @@ test_that("Adding vertex attributes to a commit network", { ) network = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices) + network = convert.edge.attributes.to.list(network) expect_true(igraph::identical_graphs(network.new.attr, network)) @@ -334,6 +339,7 @@ test_that("Adding vertex attributes to a commit network", { ) network.two = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices) + network.two = convert.edge.attributes.to.list(network.two) expect_true(igraph::identical_graphs(network.new.attr, network.two)) }) \ No newline at end of file diff --git a/tests/test-networks-equal-constructions.R b/tests/test-networks-equal-constructions.R index eae2bf3b..e64972da 100644 --- a/tests/test-networks-equal-constructions.R +++ b/tests/test-networks-equal-constructions.R @@ -42,12 +42,12 @@ compare.edge.and.vertex.lists = function(split.networks.one, split.networks.two) for (i in seq_along(split.networks.one)) { edges.one = igraph::as_data_frame(split.networks.one[[i]], what = "edges") ordering = order(edges.one[["from"]], edges.one[["to"]], - edges.one[["date"]]) + as.vector(edges.one[["date"]], "numeric")) edges.one = edges.one[ordering, ] rownames(edges.one) = seq_len(nrow(edges.one)) edges.two = igraph::as_data_frame(split.networks.two[[i]], what = "edges") ordering = order(edges.two[["from"]], edges.two[["to"]], - edges.two[["date"]]) + as.vector(edges.two[["date"]], "numeric")) edges.two = edges.two[ordering, ] rownames(edges.two) = seq_len(nrow(edges.two)) vertices.one = igraph::as_data_frame(split.networks.one[[i]], what = "vertices") diff --git a/tests/test-networks-multi-relation.R b/tests/test-networks-multi-relation.R index f215ae4b..d536cade 100644 --- a/tests/test-networks-multi-relation.R +++ b/tests/test-networks-multi-relation.R @@ -63,34 +63,44 @@ test_that("Network construction of the undirected author network with relation = "Björn", "Björn", "Olaf", "Olaf"), # mail comb.2. = c("Olaf", "Olaf", "Karl", "Karl", "Thomas", "Thomas", "Thomas", "Thomas", # cochange "Olaf", "Olaf", "Thomas", "Thomas"), # mail - date = get.date.from.string(c("2016-07-12 15:58:59", "2016-07-12 16:00:45", "2016-07-12 16:05:41", # cochange - "2016-07-12 16:06:10", "2016-07-12 16:05:41", "2016-07-12 16:06:32", - "2016-07-12 16:06:10", "2016-07-12 16:06:32", - "2016-07-12 15:58:40", "2016-07-12 15:58:50", "2016-07-12 16:04:40", # mail - "2016-07-12 16:05:37")), - artifact.type = c(rep("Feature", 8), # cochange - rep("Mail", 4)), # mail - hash = c("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "5a5ec9675e98187e1e92561e1888aa6f04faa338", - "3a0ed78458b3976243db6829f63eba3eead26774", "1143db502761379c2bfcecc2007fc34282e7ee61", - "3a0ed78458b3976243db6829f63eba3eead26774", "0a1a5c523d835459c42f33e863623138555e2526", - "1143db502761379c2bfcecc2007fc34282e7ee61", "0a1a5c523d835459c42f33e863623138555e2526", - rep(NA, 4)), - file = c("test.c", "test.c", "test2.c", "test3.c", "test2.c", "test2.c", "test3.c", "test2.c", - rep(NA, 4)), - artifact = c("A", "A", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", - rep(NA, 4)), + date = I(as.list(get.date.from.string(c("2016-07-12 15:58:59", "2016-07-12 16:00:45", "2016-07-12 16:05:41", # cochange + "2016-07-12 16:06:10", "2016-07-12 16:05:41", "2016-07-12 16:06:32", + "2016-07-12 16:06:10", "2016-07-12 16:06:32", + "2016-07-12 15:58:40", "2016-07-12 15:58:50", "2016-07-12 16:04:40", # mail + "2016-07-12 16:05:37")))), + artifact.type = I(c(as.list(rep("Feature", 8)), # cochange + as.list(rep("Mail", 4)))), # mail + hash = I(c("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "5a5ec9675e98187e1e92561e1888aa6f04faa338", + "3a0ed78458b3976243db6829f63eba3eead26774", "1143db502761379c2bfcecc2007fc34282e7ee61", + "3a0ed78458b3976243db6829f63eba3eead26774", "0a1a5c523d835459c42f33e863623138555e2526", + "1143db502761379c2bfcecc2007fc34282e7ee61", "0a1a5c523d835459c42f33e863623138555e2526", + as.list(rep(NA, 4)))), + file = I(c("test.c", "test.c", "test2.c", "test3.c", "test2.c", "test2.c", "test3.c", "test2.c", + as.list(rep(NA, 4)))), + artifact = I(c("A", "A", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", + as.list(rep(NA, 4)))), weight = 1, type = TYPE.EDGES.INTRA, relation = c(rep("cochange", 8), rep("mail", 4)), - message.id = c(NA, NA, NA, NA, NA, NA, NA, NA, - "<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", - "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>", - "<65a1sf31sagd684dfv31@mail.gmail.com>", "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>"), - thread = c(NA, NA, NA, NA, NA, NA, NA, NA, - "", "", "", "") + message.id = I(c(as.list(rep(NA, 8)), + "<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", + "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>", + "<65a1sf31sagd684dfv31@mail.gmail.com>", + "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>")), + thread = I(c(as.list(rep(NA, 8)), + "", "", "", "")) ) + ## remove the 'AsIs' class from the edge attributes that have been inserted via `I(...)` + data[["date"]] = unclass(data[["date"]]) + data[["artifact.type"]] = unclass(data[["artifact.type"]]) + data[["hash"]] = unclass(data[["hash"]]) + data[["file"]] = unclass(data[["file"]]) + data[["artifact"]] = unclass(data[["artifact"]]) + data[["message.id"]] = unclass(data[["message.id"]]) + data[["thread"]] = unclass(data[["thread"]]) + ## build expected network network.expected = igraph::graph_from_data_frame(data, vertices = authors, directed = net.conf$get.value("author.directed")) @@ -156,48 +166,56 @@ test_that("Construction of the bipartite network for the feature artifact with a "", "", "", "", "", "", "", # mail "", "", "", "", "", "", "", "", ""), - date = get.date.from.string(c("2013-05-05 21:46:30", "2013-05-05 21:49:21", "2013-05-05 21:49:34", # issue - "2013-05-06 01:04:34", "2013-05-25 03:48:41", "2013-05-25 04:08:07", - "2016-07-12 14:59:25", "2016-07-12 16:02:30", "2016-07-12 16:06:01", - "2016-07-15 19:55:39", "2017-05-23 12:32:39", "2016-07-12 15:59:59", - "2016-07-15 20:07:47", "2016-07-27 20:12:08", "2016-07-28 06:27:52", - "2013-05-25 03:25:06", "2013-05-25 06:06:53", "2013-05-25 06:22:23", - "2013-06-01 06:50:26", "2016-07-12 16:01:01", "2016-07-12 16:02:02", - "2013-04-21 23:52:09", "2016-07-12 15:59:25", "2016-07-12 16:03:59", - "2004-10-09 18:38:13", "2005-02-09 18:49:49", "2016-07-12 15:58:40", # mail - "2010-07-12 11:05:35", "2010-07-12 12:05:34", "2010-07-12 12:05:40", - "2010-07-12 12:05:41", "2010-07-12 12:05:42", "2010-07-12 12:05:43", - "2010-07-12 12:05:44", "2010-07-12 12:05:45", "2010-07-12 12:05:46", - "2016-07-12 15:58:50", "2016-07-12 16:05:37", "2016-07-12 16:04:40", - "2010-07-12 10:05:36")), - artifact.type = c(rep("IssueEvent", 24), rep("Mail", 16)), - message.id = c(rep(NA, 24), - "", "<1107974989.17910.6.camel@jmcmullan>", - "<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", - "", "", - "", "", "", - "", "", "", - "", "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>", - "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>", "<65a1sf31sagd684dfv31@mail.gmail.com>", - ""), - thread = c(rep(NA, 24), - "", "", "", "", "", "", - "", "", "", "", "", "", - "", "", "", ""), - issue.id = c("", "", "", "", # issue - "", "", - "", "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", "", - rep(NA,16)), - event.name = c(rep("commented", 24), - rep(NA, 16)), + date = I(as.list(get.date.from.string(c("2013-05-05 21:46:30", "2013-05-05 21:49:21", "2013-05-05 21:49:34", # issue + "2013-05-06 01:04:34", "2013-05-25 03:48:41", "2013-05-25 04:08:07", + "2016-07-12 14:59:25", "2016-07-12 16:02:30", "2016-07-12 16:06:01", + "2016-07-15 19:55:39", "2017-05-23 12:32:39", "2016-07-12 15:59:59", + "2016-07-15 20:07:47", "2016-07-27 20:12:08", "2016-07-28 06:27:52", + "2013-05-25 03:25:06", "2013-05-25 06:06:53", "2013-05-25 06:22:23", + "2013-06-01 06:50:26", "2016-07-12 16:01:01", "2016-07-12 16:02:02", + "2013-04-21 23:52:09", "2016-07-12 15:59:25", "2016-07-12 16:03:59", + "2004-10-09 18:38:13", "2005-02-09 18:49:49", "2016-07-12 15:58:40", # mail + "2010-07-12 11:05:35", "2010-07-12 12:05:34", "2010-07-12 12:05:40", + "2010-07-12 12:05:41", "2010-07-12 12:05:42", "2010-07-12 12:05:43", + "2010-07-12 12:05:44", "2010-07-12 12:05:45", "2010-07-12 12:05:46", + "2016-07-12 15:58:50", "2016-07-12 16:05:37", "2016-07-12 16:04:40", + "2010-07-12 10:05:36")))), + artifact.type = I(c(as.list(rep("IssueEvent", 24)), as.list(rep("Mail", 16)))), + message.id = I(c(as.list(rep(NA, 24)), + "", "<1107974989.17910.6.camel@jmcmullan>", + "<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", + "", "", + "", "", "", + "", "", "", + "", "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>", + "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>", "<65a1sf31sagd684dfv31@mail.gmail.com>", + "")), + thread = I(c(as.list(rep(NA, 24)), + "", "", "", "", "", "", + "", "", "", "", "", "", + "", "", "", "")), + issue.id = I(c("", "", "", "", # issue + "", "", + "", "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", "", + as.list(rep(NA,16)))), + event.name = I(c(rep("commented", 24), + as.list(rep(NA, 16)))), weight = 1, type = TYPE.EDGES.INTER, relation = c(rep("issue", 24), rep("mail", 16)) ) + ## remove the 'AsIs' class from the edge attributes that have been inserted via `I(...)` + network.expected.data[["date"]] = unclass(network.expected.data[["date"]]) + network.expected.data[["artifact.type"]] = unclass(network.expected.data[["artifact.type"]]) + network.expected.data[["message.id"]] = unclass(network.expected.data[["message.id"]]) + network.expected.data[["thread"]] = unclass(network.expected.data[["thread"]]) + network.expected.data[["issue.id"]] = unclass(network.expected.data[["issue.id"]]) + network.expected.data[["event.name"]] = unclass(network.expected.data[["event.name"]]) + ## 3) build expected network network.expected = igraph::graph_from_data_frame(network.expected.data, vertices = vertices, directed = net.conf$get.value("author.directed")) @@ -251,66 +269,78 @@ test_that("Construction of the multi network for the feature artifact with autho "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""), - date = get.date.from.string(c("2016-07-12 15:58:59", "2016-07-12 16:00:45", "2016-07-12 16:05:41", # author cochange - "2016-07-12 16:06:10", "2016-07-12 16:05:41", "2016-07-12 16:06:32", - "2016-07-12 16:06:10", "2016-07-12 16:06:32", - "2016-07-12 15:58:40", "2016-07-12 15:58:50", "2016-07-12 16:04:40", - "2016-07-12 16:05:37", - "2016-07-12 16:06:32", # artifact cochange - "2016-07-12 15:58:59", "2016-07-12 16:00:45", "2016-07-12 16:05:41", # bipartite cochange - "2016-07-12 16:06:10", "2016-07-12 16:06:32", "2016-07-12 16:06:32", - "2013-05-05 21:46:30", "2013-05-05 21:49:21", "2013-05-05 21:49:34", # bipartite issue - "2013-05-06 01:04:34", "2013-05-25 03:48:41", "2013-05-25 04:08:07", "2016-07-12 14:59:25", - "2016-07-12 16:02:30", "2016-07-12 16:06:01", "2016-07-15 19:55:39", "2017-05-23 12:32:39", - "2013-05-25 03:25:06", "2013-05-25 06:06:53", "2013-05-25 06:22:23", - "2013-06-01 06:50:26", "2016-07-12 16:01:01", "2016-07-12 16:02:02", - "2016-07-12 15:59:59", "2013-04-21 23:52:09", "2016-07-12 15:59:25", - "2016-07-12 16:03:59")), - artifact.type = c(rep("Feature", 8), rep("Mail", 4), rep("Feature", 1), rep("Feature", 6), - rep("IssueEvent", 21)), - hash = c("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "5a5ec9675e98187e1e92561e1888aa6f04faa338", # author cochange - "3a0ed78458b3976243db6829f63eba3eead26774", "1143db502761379c2bfcecc2007fc34282e7ee61", - "3a0ed78458b3976243db6829f63eba3eead26774", "0a1a5c523d835459c42f33e863623138555e2526", - "1143db502761379c2bfcecc2007fc34282e7ee61", "0a1a5c523d835459c42f33e863623138555e2526", - NA, NA, NA, NA, # author mail - "0a1a5c523d835459c42f33e863623138555e2526", # artifact cochange - "72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "5a5ec9675e98187e1e92561e1888aa6f04faa338", # bipartite cochange - "3a0ed78458b3976243db6829f63eba3eead26774", "1143db502761379c2bfcecc2007fc34282e7ee61", - "0a1a5c523d835459c42f33e863623138555e2526", "0a1a5c523d835459c42f33e863623138555e2526", - rep(NA, 21)), # bipartite issue - file = c("test.c", "test.c", "test2.c", "test3.c", "test2.c", "test2.c", "test3.c", "test2.c", # author cochange - NA, NA, NA, NA, - "test2.c", # artifact cochange - "test.c", "test.c", "test2.c", "test3.c", "test2.c", "test2.c", # bipartite cochange - rep(NA, 21)), - artifact = c("A", "A", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", # author cochange - "Base_Feature", - rep(NA, 4), - NA, # artifact cochange - "A", "A", "Base_Feature", "Base_Feature", "Base_Feature", "foo", # bipartite cochange - rep(NA, 21)), - weight = 1, - type = c(rep(TYPE.EDGES.INTRA, 13), rep(TYPE.EDGES.INTER, 27)), - relation = c(rep("cochange", 8), rep("mail", 4), rep("cochange", 1), rep("cochange", 6), - rep("issue", 21)), - message.id = c(rep(NA, 8), - "<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", - "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>", - "<65a1sf31sagd684dfv31@mail.gmail.com>", - "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>", - rep(NA, 28)), - thread = c(rep(NA, 8), - "", "", "", "", - rep(NA, 28)), - author.name = c(rep(NA, 12), "Thomas", rep(NA, 27)), - issue.id = c(rep(NA, 19), - "", "", "", "", # bipartite issue - "", "", "", "", "", "", - "", "", "", "", "", - "", "", "", "", "", ""), - event.name = c(rep(NA, 19), rep("commented", 21)) + date = I(as.list(get.date.from.string(c("2016-07-12 15:58:59", "2016-07-12 16:00:45", "2016-07-12 16:05:41", # author cochange + "2016-07-12 16:06:10", "2016-07-12 16:05:41", "2016-07-12 16:06:32", + "2016-07-12 16:06:10", "2016-07-12 16:06:32", + "2016-07-12 15:58:40", "2016-07-12 15:58:50", "2016-07-12 16:04:40", + "2016-07-12 16:05:37", + "2016-07-12 16:06:32", # artifact cochange + "2016-07-12 15:58:59", "2016-07-12 16:00:45", "2016-07-12 16:05:41", # bipartite cochange + "2016-07-12 16:06:10", "2016-07-12 16:06:32", "2016-07-12 16:06:32", + "2013-05-05 21:46:30", "2013-05-05 21:49:21", "2013-05-05 21:49:34", # bipartite issue + "2013-05-06 01:04:34", "2013-05-25 03:48:41", "2013-05-25 04:08:07", "2016-07-12 14:59:25", + "2016-07-12 16:02:30", "2016-07-12 16:06:01", "2016-07-15 19:55:39", "2017-05-23 12:32:39", + "2013-05-25 03:25:06", "2013-05-25 06:06:53", "2013-05-25 06:22:23", + "2013-06-01 06:50:26", "2016-07-12 16:01:01", "2016-07-12 16:02:02", + "2016-07-12 15:59:59", "2013-04-21 23:52:09", "2016-07-12 15:59:25", + "2016-07-12 16:03:59")))), + artifact.type = I(c(as.list(rep("Feature", 8)), as.list(rep("Mail", 4)), as.list(rep("Feature", 1)), as.list(rep("Feature", 6)), + as.list(rep("IssueEvent", 21)))), + hash = I(c("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "5a5ec9675e98187e1e92561e1888aa6f04faa338", # author cochange + "3a0ed78458b3976243db6829f63eba3eead26774", "1143db502761379c2bfcecc2007fc34282e7ee61", + "3a0ed78458b3976243db6829f63eba3eead26774", "0a1a5c523d835459c42f33e863623138555e2526", + "1143db502761379c2bfcecc2007fc34282e7ee61", "0a1a5c523d835459c42f33e863623138555e2526", + as.list(rep(NA, 4)), # author mail + "0a1a5c523d835459c42f33e863623138555e2526", # artifact cochange + "72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "5a5ec9675e98187e1e92561e1888aa6f04faa338", # bipartite cochange + "3a0ed78458b3976243db6829f63eba3eead26774", "1143db502761379c2bfcecc2007fc34282e7ee61", + "0a1a5c523d835459c42f33e863623138555e2526", "0a1a5c523d835459c42f33e863623138555e2526", + as.list(rep(NA, 21)))), # bipartite issue + file = I(c("test.c", "test.c", "test2.c", "test3.c", "test2.c", "test2.c", "test3.c", "test2.c", # author cochange + as.list(rep(NA, 4)), + "test2.c", # artifact cochange + "test.c", "test.c", "test2.c", "test3.c", "test2.c", "test2.c", # bipartite cochange + as.list(rep(NA, 21)))), + artifact = I(c("A", "A", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", # author cochange + "Base_Feature", + as.list(rep(NA, 4)), + NA, # artifact cochange + "A", "A", "Base_Feature", "Base_Feature", "Base_Feature", "foo", # bipartite cochange + as.list(rep(NA, 21)))), + weight = 1, + type = c(rep(TYPE.EDGES.INTRA, 13), rep(TYPE.EDGES.INTER, 27)), + relation = c(rep("cochange", 8), rep("mail", 4), rep("cochange", 1), rep("cochange", 6), + rep("issue", 21)), + message.id = I(c(as.list(rep(NA, 8)), + "<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", + "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>", + "<65a1sf31sagd684dfv31@mail.gmail.com>", + "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>", + as.list(rep(NA, 28)))), + thread = I(c(as.list(rep(NA, 8)), + "", "", "", "", + as.list(rep(NA, 28)))), + author.name = I(c(as.list(rep(NA, 12)), "Thomas", as.list(rep(NA, 27)))), + issue.id = I(c(as.list(rep(NA, 19)), + "", "", "", "", # bipartite issue + "", "", "", "", "", "", + "", "", "", "", "", + "", "", "", "", "", "")), + event.name = I(c(as.list(rep(NA, 19)), rep("commented", 21))) ) + ## Remove the 'AsIs' class from the edge attributes that have been inserted via `I(...)` + edges[["date"]] = unclass(edges[["date"]]) + edges[["artifact.type"]] = unclass(edges[["artifact.type"]]) + edges[["hash"]] = unclass(edges[["hash"]]) + edges[["file"]] = unclass(edges[["file"]]) + edges[["artifact"]] = unclass(edges[["artifact"]]) + edges[["message.id"]] = unclass(edges[["message.id"]]) + edges[["thread"]] = unclass(edges[["thread"]]) + edges[["author.name"]] = unclass(edges[["author.name"]]) + edges[["issue.id"]] = unclass(edges[["issue.id"]]) + edges[["event.name"]] = unclass(edges[["event.name"]]) + ## 3) build expected network network.expected = igraph::graph_from_data_frame(edges, vertices = vertices, directed = net.conf$get.value("author.directed")) @@ -371,44 +401,52 @@ test_that("Construction of the multi-artifact bipartite network with artifact re "","","", "","", "", "","", ""), - date = get.date.from.string(c("2016-07-12 15:58:59 UTC", "2016-07-12 16:06:10 UTC", - "2016-07-12 16:00:45 UTC", "2016-07-12 16:05:41 UTC", - "2016-07-12 16:06:32 UTC", "2016-07-12 16:06:32 UTC", - "2013-05-05 21:46:30 UTC", "2013-05-05 21:49:21 UTC", - "2013-05-05 21:49:34 UTC", "2013-05-06 01:04:34 UTC", - "2013-05-25 03:48:41 UTC", "2013-05-25 04:08:07 UTC", - "2016-07-12 14:59:25 UTC", "2016-07-12 16:02:30 UTC", - "2016-07-12 16:06:01 UTC", "2016-07-15 19:55:39 UTC", - "2017-05-23 12:32:39 UTC", "2016-07-12 15:59:59 UTC", - "2016-07-15 20:07:47 UTC", "2016-07-27 20:12:08 UTC", - "2016-07-28 06:27:52 UTC", "2013-05-25 03:25:06 UTC", - "2013-05-25 06:06:53 UTC", "2013-05-25 06:22:23 UTC", - "2013-06-01 06:50:26 UTC", "2016-07-12 16:01:01 UTC", - "2016-07-12 16:02:02 UTC", "2013-04-21 23:52:09 UTC", - "2016-07-12 15:59:25 UTC", "2016-07-12 16:03:59 UTC")), - artifact.type = c(rep("Feature", 6), rep("IssueEvent", 24)), - hash = c("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "1143db502761379c2bfcecc2007fc34282e7ee61", - "5a5ec9675e98187e1e92561e1888aa6f04faa338", "3a0ed78458b3976243db6829f63eba3eead26774", - "0a1a5c523d835459c42f33e863623138555e2526", "0a1a5c523d835459c42f33e863623138555e2526", - rep(NA, 24)), - file = c("test.c", "test3.c", "test.c", "test2.c", "test2.c", "test2.c", rep(NA, 24)), - artifact = c("A", "Base_Feature", "A", "Base_Feature", "Base_Feature", "foo", rep(NA, 24)), + date = I(as.list(get.date.from.string(c("2016-07-12 15:58:59 UTC", "2016-07-12 16:06:10 UTC", + "2016-07-12 16:00:45 UTC", "2016-07-12 16:05:41 UTC", + "2016-07-12 16:06:32 UTC", "2016-07-12 16:06:32 UTC", + "2013-05-05 21:46:30 UTC", "2013-05-05 21:49:21 UTC", + "2013-05-05 21:49:34 UTC", "2013-05-06 01:04:34 UTC", + "2013-05-25 03:48:41 UTC", "2013-05-25 04:08:07 UTC", + "2016-07-12 14:59:25 UTC", "2016-07-12 16:02:30 UTC", + "2016-07-12 16:06:01 UTC", "2016-07-15 19:55:39 UTC", + "2017-05-23 12:32:39 UTC", "2016-07-12 15:59:59 UTC", + "2016-07-15 20:07:47 UTC", "2016-07-27 20:12:08 UTC", + "2016-07-28 06:27:52 UTC", "2013-05-25 03:25:06 UTC", + "2013-05-25 06:06:53 UTC", "2013-05-25 06:22:23 UTC", + "2013-06-01 06:50:26 UTC", "2016-07-12 16:01:01 UTC", + "2016-07-12 16:02:02 UTC", "2013-04-21 23:52:09 UTC", + "2016-07-12 15:59:25 UTC", "2016-07-12 16:03:59 UTC")))), + artifact.type = I(c(as.list(rep("Feature", 6)), as.list(rep("IssueEvent", 24)))), + hash = I(c("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "1143db502761379c2bfcecc2007fc34282e7ee61", + "5a5ec9675e98187e1e92561e1888aa6f04faa338", "3a0ed78458b3976243db6829f63eba3eead26774", + "0a1a5c523d835459c42f33e863623138555e2526", "0a1a5c523d835459c42f33e863623138555e2526", + as.list(rep(NA, 24)))), + file = I(c("test.c", "test3.c", "test.c", "test2.c", "test2.c", "test2.c", as.list(rep(NA, 24)))), + artifact = I(c("A", "Base_Feature", "A", "Base_Feature", "Base_Feature", "foo", as.list(rep(NA, 24)))), weight = c(rep(1, 30)), type = c(rep("Bipartite", 30)), relation = c(rep("cochange", 6), rep("issue", 24)), - issue.id = c(NA, NA, NA, - NA, NA, NA, - "", "", "", - "", "", "", - "", "", "", - "", "", "", - "", "", "", - "", "", "", - "", "", "", - "", "", ""), - event.name = c(rep(NA, 6), rep("commented", 24)) + issue.id = I(c(as.list(rep(NA, 6)), + "", "", "", + "", "", "", + "", "", "", + "", "", "", + "", "", "", + "", "", "", + "", "", "", + "", "", "")), + event.name = I(c(as.list(rep(NA, 6)), rep("commented", 24))) ) + ## Remove the 'AsIs' class from the edge attributes that have been inserted via `I(...)` + edges[["date"]] = unclass(edges[["date"]]) + edges[["artifact.type"]] = unclass(edges[["artifact.type"]]) + edges[["hash"]] = unclass(edges[["hash"]]) + edges[["file"]] = unclass(edges[["file"]]) + edges[["artifact"]] = unclass(edges[["artifact"]]) + edges[["issue.id"]] = unclass(edges[["issue.id"]]) + edges[["event.name"]] = unclass(edges[["event.name"]]) + net.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices) assert.networks.equal(net.expected, net.combined) @@ -463,39 +501,48 @@ test_that("Construction of the multi-artifact bipartite network with artifact re "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""), - date = get.date.from.string(c("2016-07-12 15:58:59", "2016-07-12 16:06:10", "2016-07-12 16:00:45", - "2016-07-12 16:05:41", "2016-07-12 16:06:32", "2016-07-12 16:06:32", - "2004-10-09 18:38:13", "2005-02-09 18:49:49", "2016-07-12 15:58:40", - "2010-07-12 11:05:35", "2010-07-12 12:05:34", "2010-07-12 12:05:40", - "2010-07-12 12:05:41", "2010-07-12 12:05:42", "2010-07-12 12:05:43", - "2010-07-12 12:05:44", "2010-07-12 12:05:45", "2010-07-12 12:05:46", - "2016-07-12 15:58:50", "2016-07-12 16:05:37", "2016-07-12 16:04:40", - "2010-07-12 10:05:36")), - artifact.type = c(rep("Feature", 6), rep("Mail", 16)), - hash = c("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "1143db502761379c2bfcecc2007fc34282e7ee61", - "5a5ec9675e98187e1e92561e1888aa6f04faa338", "3a0ed78458b3976243db6829f63eba3eead26774", - "0a1a5c523d835459c42f33e863623138555e2526", "0a1a5c523d835459c42f33e863623138555e2526", - rep(NA, 16)), - file = c("test.c", "test3.c", "test.c", "test2.c", "test2.c", "test2.c", rep(NA, 16)), - artifact = c("A", "Base_Feature", "A", "Base_Feature", "Base_Feature", "foo", rep(NA, 16)), + date = I(as.list(get.date.from.string(c("2016-07-12 15:58:59", "2016-07-12 16:06:10", "2016-07-12 16:00:45", + "2016-07-12 16:05:41", "2016-07-12 16:06:32", "2016-07-12 16:06:32", + "2004-10-09 18:38:13", "2005-02-09 18:49:49", "2016-07-12 15:58:40", + "2010-07-12 11:05:35", "2010-07-12 12:05:34", "2010-07-12 12:05:40", + "2010-07-12 12:05:41", "2010-07-12 12:05:42", "2010-07-12 12:05:43", + "2010-07-12 12:05:44", "2010-07-12 12:05:45", "2010-07-12 12:05:46", + "2016-07-12 15:58:50", "2016-07-12 16:05:37", "2016-07-12 16:04:40", + "2010-07-12 10:05:36")))), + artifact.type = I(c(as.list(rep("Feature", 6)), as.list(rep("Mail", 16)))), + hash = I(c("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "1143db502761379c2bfcecc2007fc34282e7ee61", + "5a5ec9675e98187e1e92561e1888aa6f04faa338", "3a0ed78458b3976243db6829f63eba3eead26774", + "0a1a5c523d835459c42f33e863623138555e2526", "0a1a5c523d835459c42f33e863623138555e2526", + as.list(rep(NA, 16)))), + file = I(c("test.c", "test3.c", "test.c", "test2.c", "test2.c", "test2.c", as.list(rep(NA, 16)))), + artifact = I(c("A", "Base_Feature", "A", "Base_Feature", "Base_Feature", "foo", as.list(rep(NA, 16)))), weight = rep(1,22), type = rep("Bipartite", 22), relation = c(rep("cochange", 6), rep("mail", 16)), - message.id = c(rep(NA, 6), "", - "<1107974989.17910.6.camel@jmcmullan>", "<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", - "", "", - "", "", "", - "", "", "", - "", "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>", - "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>", - "<65a1sf31sagd684dfv31@mail.gmail.com>", "" - ), - thread = c(rep(NA, 6), "", "", "", "", - "", "", "", "", "", - "", "", "", "", "", - "", "") + message.id = I(c(as.list(rep(NA, 6)), "", + "<1107974989.17910.6.camel@jmcmullan>", "<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", + "", "", + "", "", "", + "", "", "", + "", "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>", + "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>", + "<65a1sf31sagd684dfv31@mail.gmail.com>", "" + )), + thread = I(c(as.list(rep(NA, 6)), "", "", "", "", + "", "", "", "", "", + "", "", "", "", "", + "", "")) ) + ## Remove the 'AsIs' class from the edge attributes that have been inserted via `I(...)` + edges[["date"]] = unclass(edges[["date"]]) + edges[["artifact.type"]] = unclass(edges[["artifact.type"]]) + edges[["hash"]] = unclass(edges[["hash"]]) + edges[["file"]] = unclass(edges[["file"]]) + edges[["artifact"]] = unclass(edges[["artifact"]]) + edges[["message.id"]] = unclass(edges[["message.id"]]) + edges[["thread"]] = unclass(edges[["thread"]]) + net.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices) assert.networks.equal(net.expected, net.combined) @@ -557,48 +604,56 @@ test_that("Construction of the multi-artifact bipartite network with artifact re "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""), - date = get.date.from.string(c("2013-05-05 21:46:30", "2013-05-05 21:49:21", "2013-05-05 21:49:34", - "2013-05-06 01:04:34", "2013-05-25 03:48:41", "2013-05-25 04:08:07", - "2016-07-12 14:59:25", "2016-07-12 16:02:30", "2016-07-12 16:06:01", - "2016-07-15 19:55:39", "2017-05-23 12:32:39", "2016-07-12 15:59:59", - "2016-07-15 20:07:47", "2016-07-27 20:12:08", "2016-07-28 06:27:52", - "2013-05-25 03:25:06", "2013-05-25 06:06:53", "2013-05-25 06:22:23", - "2013-06-01 06:50:26", "2016-07-12 16:01:01", "2016-07-12 16:02:02", - "2013-04-21 23:52:09", "2016-07-12 15:59:25", "2016-07-12 16:03:59", - "2004-10-09 18:38:13", "2005-02-09 18:49:49", "2016-07-12 15:58:40", - "2010-07-12 11:05:35", "2010-07-12 12:05:34", "2010-07-12 12:05:40", - "2010-07-12 12:05:41", "2010-07-12 12:05:42", "2010-07-12 12:05:43", - "2010-07-12 12:05:44", "2010-07-12 12:05:45", "2010-07-12 12:05:46", - "2016-07-12 15:58:50", "2016-07-12 16:05:37", "2016-07-12 16:04:40", - "2010-07-12 10:05:36")), - artifact.type = c(rep("IssueEvent", 24), rep("Mail", 16)), - issue.id = c("", "", "", - "", "", "", - "", "", "", - "", "", "", - "", "", "", - "", "", "", - "", "", "", - "", "", "", rep(NA, 16)), - event.name = c(rep("commented", 24), rep(NA, 16)), + date = I(as.list(get.date.from.string(c("2013-05-05 21:46:30", "2013-05-05 21:49:21", "2013-05-05 21:49:34", + "2013-05-06 01:04:34", "2013-05-25 03:48:41", "2013-05-25 04:08:07", + "2016-07-12 14:59:25", "2016-07-12 16:02:30", "2016-07-12 16:06:01", + "2016-07-15 19:55:39", "2017-05-23 12:32:39", "2016-07-12 15:59:59", + "2016-07-15 20:07:47", "2016-07-27 20:12:08", "2016-07-28 06:27:52", + "2013-05-25 03:25:06", "2013-05-25 06:06:53", "2013-05-25 06:22:23", + "2013-06-01 06:50:26", "2016-07-12 16:01:01", "2016-07-12 16:02:02", + "2013-04-21 23:52:09", "2016-07-12 15:59:25", "2016-07-12 16:03:59", + "2004-10-09 18:38:13", "2005-02-09 18:49:49", "2016-07-12 15:58:40", + "2010-07-12 11:05:35", "2010-07-12 12:05:34", "2010-07-12 12:05:40", + "2010-07-12 12:05:41", "2010-07-12 12:05:42", "2010-07-12 12:05:43", + "2010-07-12 12:05:44", "2010-07-12 12:05:45", "2010-07-12 12:05:46", + "2016-07-12 15:58:50", "2016-07-12 16:05:37", "2016-07-12 16:04:40", + "2010-07-12 10:05:36")))), + artifact.type = I(c(as.list(rep("IssueEvent", 24)), as.list(rep("Mail", 16)))), + issue.id = I(c("", "", "", + "", "", "", + "", "", "", + "", "", "", + "", "", "", + "", "", "", + "", "", "", + "", "", "", as.list(rep(NA, 16)))), + event.name = I(c(rep("commented", 24), as.list(rep(NA, 16)))), weight = rep(1, 40), type = rep("Bipartite", 40), relation = c(rep("issue", 24), rep("mail", 16)), - message.id = c(rep(NA, 24), - "", "<1107974989.17910.6.camel@jmcmullan>", - "<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", - "", "", - "", "", "", - "", "", "", - "", "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>", - "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>", - "<65a1sf31sagd684dfv31@mail.gmail.com>", "" - ), - thread = c(rep(NA, 24), "", "", "", "", "", - "", "", "", "", "", "", - "", "", "", "", "") + message.id = I(c(as.list(rep(NA, 24)), + "", "<1107974989.17910.6.camel@jmcmullan>", + "<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", + "", "", + "", "", "", + "", "", "", + "", "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>", + "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>", + "<65a1sf31sagd684dfv31@mail.gmail.com>", "" + )), + thread = I(c(as.list(rep(NA, 24)), "", "", "", "", "", + "", "", "", "", "", "", + "", "", "", "", "")) ) + ## Remove the 'AsIs' class from the edge attributes that have been inserted via `I(...)` + edges[["date"]] = unclass(edges[["date"]]) + edges[["artifact.type"]] = unclass(edges[["artifact.type"]]) + edges[["issue.id"]] = unclass(edges[["issue.id"]]) + edges[["event.name"]] = unclass(edges[["event.name"]]) + edges[["message.id"]] = unclass(edges[["message.id"]]) + edges[["thread"]] = unclass(edges[["thread"]]) + net.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices) assert.networks.equal(net.expected, net.combined) @@ -670,33 +725,33 @@ test_that("Construction of the multi-artifact bipartite network with artifact re "", "", "", "", "", "", "", "", "", "", "", "", "", ""), - date = get.date.from.string(c("2016-07-12 15:58:59", "2016-07-12 16:06:10", "2016-07-12 16:00:45", - "2016-07-12 16:05:41", "2016-07-12 16:06:32", "2016-07-12 16:06:32", - "2013-05-05 21:46:30", "2013-05-05 21:49:21", "2013-05-05 21:49:34", - "2013-05-06 01:04:34", "2013-05-25 03:48:41", "2013-05-25 04:08:07", - "2016-07-12 14:59:25", "2016-07-12 16:02:30", "2016-07-12 16:06:01", - "2016-07-15 19:55:39", "2017-05-23 12:32:39", "2016-07-12 15:59:59", - "2016-07-15 20:07:47", "2016-07-27 20:12:08", "2016-07-28 06:27:52", - "2013-05-25 03:25:06", "2013-05-25 06:06:53", "2013-05-25 06:22:23", - "2013-06-01 06:50:26", "2016-07-12 16:01:01", "2016-07-12 16:02:02", - "2013-04-21 23:52:09", "2016-07-12 15:59:25", "2016-07-12 16:03:59", - "2004-10-09 18:38:13", "2005-02-09 18:49:49", "2016-07-12 15:58:40", - "2010-07-12 11:05:35", "2010-07-12 12:05:34", "2010-07-12 12:05:40", - "2010-07-12 12:05:41", "2010-07-12 12:05:42", "2010-07-12 12:05:43", - "2010-07-12 12:05:44", "2010-07-12 12:05:45", "2010-07-12 12:05:46", - "2016-07-12 15:58:50", "2016-07-12 16:05:37", "2016-07-12 16:04:40", - "2010-07-12 10:05:36")), - artifact.type = c(rep("Feature", 6), rep("IssueEvent", 24), rep("Mail", 16)), - hash = c("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "1143db502761379c2bfcecc2007fc34282e7ee61", - "5a5ec9675e98187e1e92561e1888aa6f04faa338", "3a0ed78458b3976243db6829f63eba3eead26774", - "0a1a5c523d835459c42f33e863623138555e2526", "0a1a5c523d835459c42f33e863623138555e2526", - rep(NA, 40)), - file = c("test.c", "test3.c", "test.c", "test2.c", "test2.c", "test2.c", rep(NA, 40)), - artifact = c("A", "Base_Feature", "A", "Base_Feature", "Base_Feature", "foo", rep(NA, 40)), + date = I(as.list(get.date.from.string(c("2016-07-12 15:58:59", "2016-07-12 16:06:10", "2016-07-12 16:00:45", + "2016-07-12 16:05:41", "2016-07-12 16:06:32", "2016-07-12 16:06:32", + "2013-05-05 21:46:30", "2013-05-05 21:49:21", "2013-05-05 21:49:34", + "2013-05-06 01:04:34", "2013-05-25 03:48:41", "2013-05-25 04:08:07", + "2016-07-12 14:59:25", "2016-07-12 16:02:30", "2016-07-12 16:06:01", + "2016-07-15 19:55:39", "2017-05-23 12:32:39", "2016-07-12 15:59:59", + "2016-07-15 20:07:47", "2016-07-27 20:12:08", "2016-07-28 06:27:52", + "2013-05-25 03:25:06", "2013-05-25 06:06:53", "2013-05-25 06:22:23", + "2013-06-01 06:50:26", "2016-07-12 16:01:01", "2016-07-12 16:02:02", + "2013-04-21 23:52:09", "2016-07-12 15:59:25", "2016-07-12 16:03:59", + "2004-10-09 18:38:13", "2005-02-09 18:49:49", "2016-07-12 15:58:40", + "2010-07-12 11:05:35", "2010-07-12 12:05:34", "2010-07-12 12:05:40", + "2010-07-12 12:05:41", "2010-07-12 12:05:42", "2010-07-12 12:05:43", + "2010-07-12 12:05:44", "2010-07-12 12:05:45", "2010-07-12 12:05:46", + "2016-07-12 15:58:50", "2016-07-12 16:05:37", "2016-07-12 16:04:40", + "2010-07-12 10:05:36")))), + artifact.type = I(c(as.list(rep("Feature", 6)), as.list(rep("IssueEvent", 24)), as.list(rep("Mail", 16)))), + hash = I(c("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "1143db502761379c2bfcecc2007fc34282e7ee61", + "5a5ec9675e98187e1e92561e1888aa6f04faa338", "3a0ed78458b3976243db6829f63eba3eead26774", + "0a1a5c523d835459c42f33e863623138555e2526", "0a1a5c523d835459c42f33e863623138555e2526", + as.list(rep(NA, 40)))), + file = I(c("test.c", "test3.c", "test.c", "test2.c", "test2.c", "test2.c", as.list(rep(NA, 40)))), + artifact = I(c("A", "Base_Feature", "A", "Base_Feature", "Base_Feature", "foo", as.list(rep(NA, 40)))), weight = rep(1, 46), type = rep("Bipartite", 46), relation = c(rep("cochange", 6), rep("issue", 24), rep("mail", 16)), - issue.id = c(rep(NA, 6), "", "", + issue.id = I(c(as.list(rep(NA, 6)), "", "", "", "", "", "", "", "", "", "", "", @@ -704,22 +759,33 @@ test_that("Construction of the multi-artifact bipartite network with artifact re "", "", "", "", "", "", "", "", "", - "", rep(NA, 16)), - event.name = c(rep(NA, 6), rep("commented", 24), rep(NA, 16)), - message.id = c(rep(NA, 30), "", - "<1107974989.17910.6.camel@jmcmullan>", "<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", - "", "", - "", "", "", - "", "", "", - "", "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>", - "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>", - "<65a1sf31sagd684dfv31@mail.gmail.com>", ""), - thread = c(rep(NA, 30), "", "", "", "", + "", as.list(rep(NA, 16)))), + event.name = I(c(as.list(rep(NA, 6)), rep("commented", 24), as.list(rep(NA, 16)))), + message.id = I(c(as.list(rep(NA, 30)), "", + "<1107974989.17910.6.camel@jmcmullan>", "<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", + "", "", + "", "", "", + "", "", "", + "", "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>", + "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>", + "<65a1sf31sagd684dfv31@mail.gmail.com>", "")), + thread = I(c(as.list(rep(NA, 30)), "", "", "", "", "", "", "", "", "", "", "", "", "", "", - "", "") + "", "")) ) + ## Remove the 'AsIs' class from the edge attributes that have been inserted via `I(...)` + edges[["date"]] = unclass(edges[["date"]]) + edges[["artifact.type"]] = unclass(edges[["artifact.type"]]) + edges[["hash"]] = unclass(edges[["hash"]]) + edges[["file"]] = unclass(edges[["file"]]) + edges[["artifact"]] = unclass(edges[["artifact"]]) + edges[["issue.id"]] = unclass(edges[["issue.id"]]) + edges[["event.name"]] = unclass(edges[["event.name"]]) + edges[["message.id"]] = unclass(edges[["message.id"]]) + edges[["thread"]] = unclass(edges[["thread"]]) + net.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices) assert.networks.equal(net.expected, net.combined) diff --git a/tests/test-networks-multi.R b/tests/test-networks-multi.R index 41fec588..52770fa4 100644 --- a/tests/test-networks-multi.R +++ b/tests/test-networks-multi.R @@ -82,16 +82,21 @@ test_that("Construction of the multi network for the feature artifact with autho "0a1a5c523d835459c42f33e863623138555e2526"), file = c("test.c", "test.c", "test2.c", "test3.c", "test2.c", "test2.c", "test3.c", "test2.c", "test2.c", "test.c", "test.c", "test2.c", "test3.c", "test2.c", "test2.c"), - artifact = c("A", "A", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", - "Base_Feature", NA, "A", "A", "Base_Feature", "Base_Feature", "Base_Feature", - "foo"), + artifact = I(list("A", "A", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", + "Base_Feature", NA, "A", "A", "Base_Feature", "Base_Feature", "Base_Feature", + "foo")), weight = 1, type = c(rep(TYPE.EDGES.INTRA, 9), rep(TYPE.EDGES.INTER, 6)), relation = "cochange", - author.name = c(NA, NA, NA, NA, NA, NA, NA, NA, "Thomas", NA, NA, NA, NA, NA, NA) + author.name = I(list(NA, NA, NA, NA, NA, NA, NA, NA, "Thomas", NA, NA, NA, NA, NA, NA)) ) + ## remove the 'AsIs' class from the edge attributes that have been inserted via `I(...)` + edges[["artifact"]] = unclass(edges[["artifact"]]) + edges[["author.name"]] = unclass(edges[["author.name"]]) + network.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices) + network.expected = convert.edge.attributes.to.list(network.expected) assert.networks.equal(network.expected, network.built) }) diff --git a/tests/test-networks.R b/tests/test-networks.R index 96069a3c..f1536ed9 100644 --- a/tests/test-networks.R +++ b/tests/test-networks.R @@ -135,34 +135,34 @@ test_that("Simplify author-network with relation = c('cochange', 'mail') using b "Björn", "Olaf"), # mail comb.2. = c("Olaf", "Karl", "Thomas", "Thomas", # cochange "Olaf", "Thomas")) # mail - data$date = list(get.date.from.string(c("2016-07-12 15:58:59", "2016-07-12 16:00:45")), - get.date.from.string(c("2016-07-12 16:05:41", "2016-07-12 16:06:10")), - get.date.from.string(c("2016-07-12 16:05:41", "2016-07-12 16:06:32")), - get.date.from.string(c("2016-07-12 16:06:10", "2016-07-12 16:06:32")), # cochange - get.date.from.string(c("2016-07-12 15:58:40", "2016-07-12 15:58:50")), - get.date.from.string(c("2016-07-12 16:04:40", "2016-07-12 16:05:37"))) # mail - data$artifact.type = list(c("Feature", "Feature"), c("Feature", "Feature"), - c("Feature", "Feature"), c("Feature", "Feature"), # cochange - c("Mail", "Mail"), c("Mail", "Mail")) # mail - data$hash = list(c("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "5a5ec9675e98187e1e92561e1888aa6f04faa338"), - c("3a0ed78458b3976243db6829f63eba3eead26774", "1143db502761379c2bfcecc2007fc34282e7ee61"), - c("3a0ed78458b3976243db6829f63eba3eead26774", "0a1a5c523d835459c42f33e863623138555e2526"), - c("1143db502761379c2bfcecc2007fc34282e7ee61", "0a1a5c523d835459c42f33e863623138555e2526"), - as.character(c(NA, NA)), as.character(c(NA, NA))) - data$file = list(c("test.c", "test.c"), c("test2.c", "test3.c"), c("test2.c", "test2.c"), c("test3.c", "test2.c"), - as.character(c(NA, NA)), as.character(c(NA, NA))) - data$artifact = list(c("A", "A"), c("Base_Feature", "Base_Feature"), c("Base_Feature", "Base_Feature"), - c("Base_Feature", "Base_Feature"), as.character(c(NA, NA)), as.character(c(NA, NA))) + data$date = list(as.list(get.date.from.string(c("2016-07-12 15:58:59", "2016-07-12 16:00:45"))), + as.list(get.date.from.string(c("2016-07-12 16:05:41", "2016-07-12 16:06:10"))), + as.list(get.date.from.string(c("2016-07-12 16:05:41", "2016-07-12 16:06:32"))), + as.list(get.date.from.string(c("2016-07-12 16:06:10", "2016-07-12 16:06:32"))), # cochange + as.list(get.date.from.string(c("2016-07-12 15:58:40", "2016-07-12 15:58:50"))), + as.list(get.date.from.string(c("2016-07-12 16:04:40", "2016-07-12 16:05:37")))) # mail + data$artifact.type = list(list("Feature", "Feature"), list("Feature", "Feature"), + list("Feature", "Feature"), list("Feature", "Feature"), # cochange + list("Mail", "Mail"), list("Mail", "Mail")) # mail + data$hash = list(list("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "5a5ec9675e98187e1e92561e1888aa6f04faa338"), + list("3a0ed78458b3976243db6829f63eba3eead26774", "1143db502761379c2bfcecc2007fc34282e7ee61"), + list("3a0ed78458b3976243db6829f63eba3eead26774", "0a1a5c523d835459c42f33e863623138555e2526"), + list("1143db502761379c2bfcecc2007fc34282e7ee61", "0a1a5c523d835459c42f33e863623138555e2526"), + as.list(rep(NA, 2)), as.list(rep(NA, 2))) + data$file = list(list("test.c", "test.c"), list("test2.c", "test3.c"), list("test2.c", "test2.c"), list("test3.c", "test2.c"), + as.list(rep(NA, 2)), as.list(rep(NA, 2))) + data$artifact = list(list("A", "A"), list("Base_Feature", "Base_Feature"), list("Base_Feature", "Base_Feature"), + list("Base_Feature", "Base_Feature"), as.list(rep(NA, 2)), as.list(rep(NA, 2))) data$weight = rep(2, 6) data$type = rep(TYPE.EDGES.INTRA, 6) data$relation = c(rep("cochange", 4), rep("mail", 2)) - data$message.id = list(as.character(c(NA, NA)), as.character(c(NA, NA)), as.character(c(NA, NA)), as.character(c(NA, NA)), - c("<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", - "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>"), - c("<65a1sf31sagd684dfv31@mail.gmail.com>", - "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>")) - data$thread = list(as.character(c(NA, NA)), as.character(c(NA, NA)), as.character(c(NA, NA)), as.character(c(NA, NA)), - c("", ""), c("", "")) + data$message.id = list(as.list(rep(NA, 2)), as.list(rep(NA, 2)), as.list(rep(NA, 2)), as.list(rep(NA, 2)), + list("<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", + "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>"), + list("<65a1sf31sagd684dfv31@mail.gmail.com>", + "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>")) + data$thread = list(as.list(rep(NA, 2)), as.list(rep(NA, 2)), as.list(rep(NA, 2)), as.list(rep(NA, 2)), + list("", ""), list("", "")) ## build expected network network.expected = igraph::graph_from_data_frame(data, vertices = authors, @@ -179,37 +179,38 @@ test_that("Simplify author-network with relation = c('cochange', 'mail') using b data = data.frame(comb.1. = c("Björn", "Olaf", "Olaf", "Karl"), comb.2. = c("Olaf", "Karl", "Thomas", "Thomas")) - data$date = list(get.date.from.string(c("2016-07-12 15:58:59", "2016-07-12 16:00:45", # cochange - "2016-07-12 15:58:40", "2016-07-12 15:58:50")), # mail - get.date.from.string(c("2016-07-12 16:05:41", "2016-07-12 16:06:10")), # cochange - get.date.from.string(c("2016-07-12 16:05:41", "2016-07-12 16:06:32", # cochange - "2016-07-12 16:04:40", "2016-07-12 16:05:37")), # mail - get.date.from.string(c("2016-07-12 16:06:10", "2016-07-12 16:06:32"))) # cochange - data$artifact.type = list(c("Feature", "Feature", "Mail", "Mail"), - c("Feature", "Feature"), - c("Feature", "Feature", "Mail", "Mail"), - c("Feature", "Feature")) - data$hash = list(as.character(c("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "5a5ec9675e98187e1e92561e1888aa6f04faa338", NA, NA)), - c("3a0ed78458b3976243db6829f63eba3eead26774", "1143db502761379c2bfcecc2007fc34282e7ee61"), - as.character(c("3a0ed78458b3976243db6829f63eba3eead26774", "0a1a5c523d835459c42f33e863623138555e2526", NA, NA)), - c("1143db502761379c2bfcecc2007fc34282e7ee61", "0a1a5c523d835459c42f33e863623138555e2526")) - data$file = list(as.character(c("test.c", "test.c", NA, NA)), c("test2.c", "test3.c"), - as.character(c("test2.c", "test2.c", NA, NA)), c("test3.c", "test2.c")) - data$artifact = list(as.character(c("A", "A", NA, NA)), c("Base_Feature", "Base_Feature"), - as.character(c("Base_Feature", "Base_Feature", NA, NA)), c("Base_Feature", "Base_Feature")) + data$date = list(as.list(get.date.from.string(c("2016-07-12 15:58:59", "2016-07-12 16:00:45", # cochange + "2016-07-12 15:58:40", "2016-07-12 15:58:50"))), # mail + as.list(get.date.from.string(c("2016-07-12 16:05:41", "2016-07-12 16:06:10"))), # cochange + as.list(get.date.from.string(c("2016-07-12 16:05:41", "2016-07-12 16:06:32", # cochange + "2016-07-12 16:04:40", "2016-07-12 16:05:37"))), # mail + as.list(get.date.from.string(c("2016-07-12 16:06:10", "2016-07-12 16:06:32")))) # cochange + data$artifact.type = list(list("Feature", "Feature", "Mail", "Mail"), + list("Feature", "Feature"), + list("Feature", "Feature", "Mail", "Mail"), + list("Feature", "Feature")) + + data$hash = list(list("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "5a5ec9675e98187e1e92561e1888aa6f04faa338", NA, NA), + list("3a0ed78458b3976243db6829f63eba3eead26774", "1143db502761379c2bfcecc2007fc34282e7ee61"), + list("3a0ed78458b3976243db6829f63eba3eead26774", "0a1a5c523d835459c42f33e863623138555e2526", NA, NA), + list("1143db502761379c2bfcecc2007fc34282e7ee61", "0a1a5c523d835459c42f33e863623138555e2526")) + data$file = list(list("test.c", "test.c", NA, NA), list("test2.c", "test3.c"), + list("test2.c", "test2.c", NA, NA), list("test3.c", "test2.c")) + data$artifact = list(list("A", "A", NA, NA), list("Base_Feature", "Base_Feature"), + list("Base_Feature", "Base_Feature", NA, NA), list("Base_Feature", "Base_Feature")) data$weight = c(4, 2, 4, 2) data$type = rep(TYPE.EDGES.INTRA, 4) data$relation = list(c("cochange", "mail"), c("cochange"), c("cochange", "mail"), c("cochange")) - data$message.id = list(as.character(c(NA, NA, "<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", - "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>")), - as.character(c(NA, NA)), - as.character(c(NA, NA, "<65a1sf31sagd684dfv31@mail.gmail.com>", - "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>")), - as.character(c(NA, NA))) - data$thread = list(as.character(c(NA, NA, "", "")), - as.character(c(NA, NA)), - as.character(c(NA, NA, "", "")), - as.character(c(NA, NA))) + data$message.id = list(list(NA, NA, "<4cbaa9ef0802201124v37f1eec8g89a412dfbfc8383a@mail.gmail.com>", + "<6784529b0802032245r5164f984l342f0f0dc94aa420@mail.gmail.com>"), + list(NA, NA), + list(NA, NA, "<65a1sf31sagd684dfv31@mail.gmail.com>", + "<9b06e8d20801220234h659c18a3g95c12ac38248c7e0@mail.gmail.com>"), + list(NA, NA)) + data$thread = list(list(NA, NA, "", ""), + list(NA, NA), + list(NA, NA, "", ""), + list(NA, NA)) ## build expected network network.expected = igraph::graph_from_data_frame(data, vertices = authors, @@ -354,6 +355,7 @@ test_that("Remove duplicate edges", { ## build expected network network.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices) + network.expected = convert.edge.attributes.to.list(network.expected) ## build network with unique edges network = network.builder$get.author.network() diff --git a/tests/test-split-misc.R b/tests/test-split-misc.R index da63b069..12f54126 100644 --- a/tests/test-split-misc.R +++ b/tests/test-split-misc.R @@ -394,6 +394,7 @@ test_that("Check and correct duplicate range names during network activity-based igraph::edges(rep(c("A", "B"), times = length(dates))) ## set some date attributes that are appropriate for the test case net = igraph::set_edge_attr(net, "date", value = dates) + net = convert.edge.attributes.to.list(net) ## define split arguments split.function = split.network.activity.based