Skip to content

Commit 49061c9

Browse files
authored
Merge pull request #641 from remlapmot/improve-tests
Tweak tests
2 parents a3a65d6 + d9ac10c commit 49061c9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/testthat/test_otherformats.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ test_that("radial MR dat", {
4343

4444
test_that("radial MR", {
4545
w <- dat_to_RadialMR(dat)
46-
expect_warning(o <- RadialMR::ivw_radial(w[[1]]))
46+
utils::capture.output(expect_warning(o <- RadialMR::ivw_radial(w[[1]])))
4747
expect_true(class(o) == "IVW")
4848
})
4949

5050

5151
test_that("radial MR", {
52-
w <- mr_ivw_radial(dat$beta.exposure, dat$beta.outcome, dat$se.exposure, dat$se.outcome)
52+
utils::capture.output(w <- mr_ivw_radial(dat$beta.exposure, dat$beta.outcome, dat$se.exposure, dat$se.outcome))
5353
expect_true(class(w) == "list")
5454
})

tests/testthat/test_plots.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ test_that("Forest plot 1 to many", {
6969
trans = "log2",
7070
xlab = "OR for CHD per SD increase in risk factor (95% confidence interval)",
7171
weight = "weight"
72-
), regexp = "Removed 6 rows containing missing values or values outside the scale range *")
72+
), regexp = "Removed 6 rows")
7373
})
7474

7575
test_that("Forest plot 1 to many test 2", {
7676
res$pval<-formatC(res$pval, format = "e", digits = 2)
77-
expect_warning(p9 <- forest_plot_1_to_many(
77+
expect_warning(p9 <- utils::capture.output(forest_plot_1_to_many(
7878
res,
7979
b = "b",
8080
se = "se",
@@ -94,7 +94,7 @@ test_that("Forest plot 1 to many test 2", {
9494
addcols = c("nsnp", "pval"),
9595
addcol_widths = c(1.0, 1.0),
9696
addcol_titles = c("No. SNPs", "P-val")
97-
), regexp = "Removed 6 rows containing missing values or values outside the scale range *")
97+
), regexp = "Removed 6 rows"))
9898
})
9999

100100
test_that("Forest plot 1 to many test 3 - with subcategory in by argument", {
@@ -121,5 +121,5 @@ test_that("Forest plot 1 to many test 3 - with subcategory in by argument", {
121121
xlab = "OR for CHD per SD increase in risk factor (95% confidence interval)",
122122
subheading_size = 14,
123123
weight = "weight"
124-
), regexp = "Removed 3 rows containing missing values or values outside the scale range *")
124+
), regexp = "Removed 3 rows")
125125
})

0 commit comments

Comments
 (0)