Skip to content

Commit cc4c3d0

Browse files
Merge pull request datashield#364 from StuartWheater/v6.1.1-dev
Commented out 'pairwise' tests
2 parents a400acb + 4ef3523 commit cc4c3d0

5 files changed

Lines changed: 49 additions & 43 deletions

File tree

tests/testthat/test-disc-ds.cor.R

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ test_that("simple D3 setup", {
4646
expect_equal(res$`dimensions of D3 in combined studies`[2], 4)
4747
})
4848

49-
test_that("simple disc test, naAction='casewise.complete', type='split'", {
50-
expect_error(ds.cor('D3', naAction='casewise.complete', type='split'), "There are some DataSHIELD errors, list them with datashield.errors()", fixed = TRUE)
49+
#test_that("simple disc test, naAction='casewise.complete', type='split'", {
50+
test_that("simple disc test, type='split'", {
51+
# expect_error(ds.cor('D3', naAction='casewise.complete', type='split'), "There are some DataSHIELD errors, list them with datashield.errors()", fixed = TRUE)
52+
expect_error(ds.cor('D3', type='split'), "There are some DataSHIELD errors, list them with datashield.errors()", fixed = TRUE)
5153
res.errors <- DSI::datashield.errors()
5254

5355
expect_length(res.errors, 1)
54-
expect_equal(res.errors$sim2, "Command 'corDS(\"D3\", NULL, \"casewise.complete\")' failed on 'sim2': Error while evaluating 'dsBase::corDS(\"D3\", NULL, \"casewise.complete\")' -> Error : ERROR: The ratio of the number of variables over the number of individual-level\n records exceeds the allowed threshold, there is a possible risk of disclosure\n", fixed = TRUE)
56+
expect_equal(res.errors$sim2, "Command 'corDS(\"D3\", NULL)' failed on 'sim2': Error while evaluating 'dsBase::corDS(\"D3\", NULL)' -> Error : ERROR: The ratio of the number of variables over the number of individual-level\n records exceeds the allowed threshold, there is a possible risk of disclosure\n", fixed = TRUE)
5557
})
5658

5759
test_that("simple disc test, naAction='pairwise.complete', type='split'", {
@@ -69,12 +71,14 @@ test_that("simple disc test, naAction='pairwise.complete', type='split'", {
6971
# expect_true(is.na(res[[3]]$`Error message`))
7072
})
7173

72-
test_that("simple disc test, naAction='casewise.complete', type='combine'", {
73-
expect_error(ds.cor('D3', naAction='casewise.complete', type='combine'), "There are some DataSHIELD errors, list them with datashield.errors()", fixed = TRUE)
74+
#test_that("simple disc test, naAction='casewise.complete', type='combine'", {
75+
test_that("simple disc test, type='combine'", {
76+
# expect_error(ds.cor('D3', naAction='casewise.complete', type='combine'), "There are some DataSHIELD errors, list them with datashield.errors()", fixed = TRUE)
77+
expect_error(ds.cor('D3', type='combine'), "There are some DataSHIELD errors, list them with datashield.errors()", fixed = TRUE)
7478
res.errors <- DSI::datashield.errors()
7579

7680
expect_length(res.errors, 1)
77-
expect_equal(res.errors$sim2, "Command 'corDS(\"D3\", NULL, \"casewise.complete\")' failed on 'sim2': Error while evaluating 'dsBase::corDS(\"D3\", NULL, \"casewise.complete\")' -> Error : ERROR: The ratio of the number of variables over the number of individual-level\n records exceeds the allowed threshold, there is a possible risk of disclosure\n", fixed = TRUE)
81+
expect_equal(res.errors$sim2, "Command 'corDS(\"D3\", NULL)' failed on 'sim2': Error while evaluating 'dsBase::corDS(\"D3\", NULL)' -> Error : ERROR: The ratio of the number of variables over the number of individual-level\n records exceeds the allowed threshold, there is a possible risk of disclosure\n", fixed = TRUE)
7882

7983
# expect_length(res, 5)
8084
# expect_length(res$`Error message`, 3)

tests/testthat/test-smk-ds.cor.R

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,19 @@ test_that("setup", {
2626

2727
context("ds.cor::smk")
2828

29-
test_that("simple test, combine, pairwise.complete", {
30-
res <- ds.cor(x="D$survtime", y="D$time.id", type="combine", naAction="pairwise.complete")
31-
32-
expect_length(res, 4)
33-
expect_true("matrix" %in% class(res$`Number of missing values in each variable`))
34-
expect_true("matrix" %in% class(res$`Number of missing values pairwise`))
35-
expect_true("matrix" %in% class(res$`Correlation Matrix`))
36-
expect_true("matrix" %in% class(res$`Number of complete cases used`))
37-
})
29+
#test_that("simple test, combine, pairwise.complete", {
30+
# res <- ds.cor(x="D$survtime", y="D$time.id", type="combine", naAction="pairwise.complete")
31+
#
32+
# expect_length(res, 4)
33+
# expect_true("matrix" %in% class(res$`Number of missing values in each variable`))
34+
# expect_true("matrix" %in% class(res$`Number of missing values pairwise`))
35+
# expect_true("matrix" %in% class(res$`Correlation Matrix`))
36+
# expect_true("matrix" %in% class(res$`Number of complete cases used`))
37+
#})
3838

3939
test_that("simple test, combine, casewise.complete", {
40-
res <- ds.cor(x="D$survtime", y="D$time.id", type="combine", naAction="casewise.complete")
40+
# res <- ds.cor(x="D$survtime", y="D$time.id", type="combine", naAction="casewise.complete")
41+
res <- ds.cor(x="D$survtime", y="D$time.id", type="combine")
4142

4243
expect_length(res, 4)
4344
expect_true("matrix" %in% class(res$`Number of missing values in each variable`))
@@ -46,29 +47,30 @@ test_that("simple test, combine, casewise.complete", {
4647
expect_true("matrix" %in% class(res$`Number of complete cases used`))
4748
})
4849

49-
test_that("simple test, split, pairwise.complete", {
50-
res <- ds.cor(x="D$survtime", y="D$time.id", type="split", naAction="pairwise.complete")
51-
52-
expect_length(res, 3)
53-
expect_length(res[[1]], 4)
54-
expect_true("matrix" %in% class(res[[1]]$`Number of missing values in each variable`))
55-
expect_true("matrix" %in% class(res[[1]]$`Number of missing values pairwise`))
56-
expect_true("matrix" %in% class(res[[1]]$`Correlation Matrix`))
57-
expect_true("matrix" %in% class(res[[1]]$`Number of complete cases used`))
58-
expect_length(res[[2]], 4)
59-
expect_true("matrix" %in% class(res[[2]]$`Number of missing values in each variable`))
60-
expect_true("matrix" %in% class(res[[2]]$`Number of missing values pairwise`))
61-
expect_true("matrix" %in% class(res[[2]]$`Correlation Matrix`))
62-
expect_true("matrix" %in% class(res[[2]]$`Number of complete cases used`))
63-
expect_length(res[[3]], 4)
64-
expect_true("matrix" %in% class(res[[3]]$`Number of missing values in each variable`))
65-
expect_true("matrix" %in% class(res[[3]]$`Number of missing values pairwise`))
66-
expect_true("matrix" %in% class(res[[3]]$`Correlation Matrix`))
67-
expect_true("matrix" %in% class(res[[3]]$`Number of complete cases used`))
68-
})
50+
#test_that("simple test, split, pairwise.complete", {
51+
# res <- ds.cor(x="D$survtime", y="D$time.id", type="split", naAction="pairwise.complete")
52+
#
53+
# expect_length(res, 3)
54+
# expect_length(res[[1]], 4)
55+
# expect_true("matrix" %in% class(res[[1]]$`Number of missing values in each variable`))
56+
# expect_true("matrix" %in% class(res[[1]]$`Number of missing values pairwise`))
57+
# expect_true("matrix" %in% class(res[[1]]$`Correlation Matrix`))
58+
# expect_true("matrix" %in% class(res[[1]]$`Number of complete cases used`))
59+
# expect_length(res[[2]], 4)
60+
# expect_true("matrix" %in% class(res[[2]]$`Number of missing values in each variable`))
61+
# expect_true("matrix" %in% class(res[[2]]$`Number of missing values pairwise`))
62+
# expect_true("matrix" %in% class(res[[2]]$`Correlation Matrix`))
63+
# expect_true("matrix" %in% class(res[[2]]$`Number of complete cases used`))
64+
# expect_length(res[[3]], 4)
65+
# expect_true("matrix" %in% class(res[[3]]$`Number of missing values in each variable`))
66+
# expect_true("matrix" %in% class(res[[3]]$`Number of missing values pairwise`))
67+
# expect_true("matrix" %in% class(res[[3]]$`Correlation Matrix`))
68+
# expect_true("matrix" %in% class(res[[3]]$`Number of complete cases used`))
69+
#})
6970

7071
test_that("simple test, split, casewise.complete", {
71-
res <- ds.cor(x="D$survtime", y="D$time.id", type="split", naAction="casewise.complete")
72+
# res <- ds.cor(x="D$survtime", y="D$time.id", type="split", naAction="casewise.complete")
73+
res <- ds.cor(x="D$survtime", y="D$time.id", type="split")
7274

7375
expect_length(res, 3)
7476
expect_length(res[[1]], 4)

tests/testthat/test-smk-ds.glm-binomial.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ test_that("setup", {
2626

2727
context("ds.glm::smk::binomial")
2828
test_that("glm_binomial", {
29-
res <- ds.glm('D$DIS_DIAB~D$GENDER*D$PM_BMI_CONTINUOUS+D$LAB_HDL', family="binomial")
29+
res <- ds.glm('D$DIS_DIAB~D$GENDER*D$PM_BMI_CONTINUOUS+D$LAB_HDL', family="binomial", checks=FALSE)
3030

3131
expect_length(res, 13)
3232
expect_equal(res$Nvalid, 7485)
@@ -52,7 +52,7 @@ test_that("glm_binomial", {
5252

5353
context("ds.glm::smk::binomial, with check")
5454
test_that("glm_binomial, with check", {
55-
expect_warning(res <- ds.glm('D$DIS_DIAB~D$GENDER*D$PM_BMI_CONTINUOUS+D$LAB_HDL', family="binomial", check=TRUE), "NAs introduced by coercion")
55+
expect_warning(res <- ds.glm('D$DIS_DIAB~D$GENDER*D$PM_BMI_CONTINUOUS+D$LAB_HDL', family="binomial", checks=TRUE), "NAs introduced by coercion")
5656

5757
expect_length(res, 13)
5858
expect_equal(res$Nvalid, 7485)

tests/testthat/test-smk-ds.glm-gaussian.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ test_that("setup", {
2626

2727
context("ds.glm::smk::gaussian")
2828
test_that("glm_gaussian", {
29-
res <- ds.glm('D$LAB_TSC~D$LAB_TRIG',family="gaussian")
29+
res <- ds.glm('D$LAB_TSC~D$LAB_TRIG',family="gaussian",checks=FALSE)
3030

3131
expect_length(res, 13)
3232
expect_equal(res$Nvalid, 7800)
@@ -52,7 +52,7 @@ test_that("glm_gaussian", {
5252

5353
context("ds.glm::smk::gaussian, with check")
5454
test_that("glm_gaussian, with check", {
55-
expect_warning(res <- ds.glm('D$LAB_TSC~D$LAB_TRIG', family="gaussian", check=TRUE), "NAs introduced by coercion")
55+
expect_warning(res <- ds.glm('D$LAB_TSC~D$LAB_TRIG', family="gaussian", checks=TRUE), "NAs introduced by coercion")
5656

5757
expect_length(res, 13)
5858
expect_equal(res$Nvalid, 7800)

tests/testthat/test-smk-ds.glm-poisson.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ test_that("setup", {
2626

2727
context("ds.glm::smk::poisson")
2828
test_that("glm_gaussian", {
29-
res <- ds.glm("D$survtime~1+D$time.id+D$female",family="poisson")
29+
res <- ds.glm("D$survtime~1+D$time.id+D$female", family="poisson", checks=FALSE)
3030

3131
expect_length(res, 13)
3232
expect_equal(res$Nvalid, 6299)
@@ -52,7 +52,7 @@ test_that("glm_gaussian", {
5252

5353
context("ds.glm::smk::poisson, with check")
5454
test_that("glm_gaussian, which check", {
55-
expect_warning(res <- ds.glm("D$survtime~1+D$time.id+D$female", family="poisson", check=TRUE), "NAs introduced by coercion")
55+
expect_warning(res <- ds.glm("D$survtime~1+D$time.id+D$female", family="poisson", checks=TRUE), "NAs introduced by coercion")
5656

5757
expect_length(res, 13)
5858
expect_equal(res$Nvalid, 6299)

0 commit comments

Comments
 (0)