|
1 | 1 | test_that("getLevel works", { |
2 | 2 | ## Generate some data |
3 | | - library(TreeSummarizedExperiment) |
4 | | - library(ggtree) |
| 3 | + suppressPackageStartupMessages(library(TreeSummarizedExperiment)) |
| 4 | + suppressPackageStartupMessages(library(ggtree)) |
5 | 5 | data(tinyTree) |
6 | 6 | set.seed(1) |
7 | 7 | pv <- runif(19, min = 0.09, max = 0.11) |
@@ -107,12 +107,14 @@ test_that("getLevel works", { |
107 | 107 | message = TRUE), |
108 | 108 | "The result will be output in the 'keep' column") |
109 | 109 |
|
110 | | - expect_error(getLevel(tree = tinyTree, score_data = out, |
111 | | - drop = "pvalue > 0.05", |
112 | | - score_column = "pvalue", node_column = "node", |
113 | | - get_max = FALSE, parent_first = TRUE, |
114 | | - message = TRUE), |
115 | | - "'drop' must be or evaluate to logical") |
| 110 | + expect_message(expect_message( |
| 111 | + expect_error(getLevel(tree = tinyTree, score_data = out, |
| 112 | + drop = "pvalue > 0.05", |
| 113 | + score_column = "pvalue", node_column = "node", |
| 114 | + get_max = FALSE, parent_first = TRUE, |
| 115 | + message = TRUE), |
| 116 | + "'drop' must be or evaluate to logical"), |
| 117 | + "Preparing"), "Dropping") |
116 | 118 |
|
117 | 119 | ## Check that function works as expected for valid input |
118 | 120 | ## ------------------------------------------------------------------------- |
@@ -186,21 +188,25 @@ test_that("getLevel works", { |
186 | 188 | expect_equal(final$node[final$keep], c(1, 2, 3, 6, 7, 8, 9, 10, 18)) |
187 | 189 |
|
188 | 190 | ## Search for the highest value, don't filter, parent_first = FALSE |
189 | | - final <- getLevel(tree = tinyTree, score_data = out, |
190 | | - drop = pvalue > 1, score_column = "pvalue", |
191 | | - node_column = "node", get_max = TRUE, |
192 | | - parent_first = FALSE, message = TRUE) |
| 191 | + suppressMessages({ |
| 192 | + final <- getLevel(tree = tinyTree, score_data = out, |
| 193 | + drop = pvalue > 1, score_column = "pvalue", |
| 194 | + node_column = "node", get_max = TRUE, |
| 195 | + parent_first = FALSE, message = TRUE) |
| 196 | + }) |
193 | 197 | expect_s3_class(final, "data.frame") |
194 | 198 | expect_equal(nrow(final), nrow(out)) |
195 | 199 | expect_equal(final$node, out$node) |
196 | 200 | expect_equal(final$pvalue, out$pvalue) |
197 | 201 | expect_equal(final$node[final$keep], c(1, 2, 3, 6, 7, 8, 9, 10, 18)) |
198 | 202 |
|
199 | 203 | ## Search for the highest value, don't filter, parent_first = FALSE |
200 | | - final <- getLevel(tree = tinyTree, score_data = out, |
201 | | - score_column = "pvalue", |
202 | | - node_column = "node", get_max = TRUE, |
203 | | - parent_first = FALSE, message = TRUE) |
| 204 | + suppressMessages({ |
| 205 | + final <- getLevel(tree = tinyTree, score_data = out, |
| 206 | + score_column = "pvalue", |
| 207 | + node_column = "node", get_max = TRUE, |
| 208 | + parent_first = FALSE, message = TRUE) |
| 209 | + }) |
204 | 210 | expect_s3_class(final, "data.frame") |
205 | 211 | expect_equal(nrow(final), nrow(out)) |
206 | 212 | expect_equal(final$node, out$node) |
|
0 commit comments