Skip to content

Commit

Permalink
Merge pull request #252 from oxford-pharmacoepi/skip_on_cran2
Browse files Browse the repository at this point in the history
tests skipped
  • Loading branch information
xihang-chen authored May 30, 2024
2 parents 8d9664f + e85bc8a commit 4dbc273
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 42 deletions.
76 changes: 39 additions & 37 deletions tests/testthat/test-generateSequenceCohortSet.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ test_that("multiple entries per person", {

#### Combination Window
test_that("change combinationWindow one ID against one ID, example 1", {
skip_on_cran()
cdm <- mockCohortSymmetry()

cdm <- generateSequenceCohortSet(cdm,
Expand Down Expand Up @@ -352,35 +353,35 @@ test_that("a subset of IDs against a subset of IDs", {
test_that("example of changed combinationWindow", {
cdm <- mockCohortSymmetry()
cdm <- generateSequenceCohortSet(cdm,
name = "joined_cohorts",
indexTable ="cohort_1",
indexId = 3,
markerTable = "cohort_2",
markerId = 3
name = "joined_cohorts",
indexTable ="cohort_1",
indexId = 3,
markerTable = "cohort_2",
markerId = 3
)

expect_true(cdm$joined_cohorts %>% dplyr::tally() %>% dplyr::pull(n) == 1) # default time, 1 entry

cdm <- generateSequenceCohortSet(cdm,
name = "joined_cohorts",
indexTable ="cohort_1",
indexId = 3,
markerTable = "cohort_2",
markerId = 3,
combinationWindow = c(0,Inf)
name = "joined_cohorts",
indexTable ="cohort_1",
indexId = 3,
markerTable = "cohort_2",
markerId = 3,
combinationWindow = c(0,Inf)
)
loc <- cdm$joined_cohorts %>%
dplyr::inner_join(CDMConnector::settings(cdm$joined_cohorts), by = "cohort_definition_id", copy = T) %>%
dplyr::collect()
expect_true(loc %>% dplyr::tally() %>% dplyr::pull(n) == 4) #inf gives more values

cdm <- generateSequenceCohortSet(cdm,
name = "joined_cohorts",
indexTable ="cohort_1",
indexId = 3,
markerTable = "cohort_2",
markerId = 1,
combinationWindow = c(0,Inf)
name = "joined_cohorts",
indexTable ="cohort_1",
indexId = 3,
markerTable = "cohort_2",
markerId = 1,
combinationWindow = c(0,Inf)
)
loc <- cdm$joined_cohorts %>%
dplyr::inner_join(CDMConnector::settings(cdm$joined_cohorts), by = "cohort_definition_id", copy = T) %>%
Expand All @@ -389,12 +390,12 @@ test_that("example of changed combinationWindow", {
expect_true(all(loc %>% dplyr::select(subject_id) %>% dplyr::pull() == c(1,3)))

cdm <- generateSequenceCohortSet(cdm,
name = "joined_cohorts",
indexTable ="cohort_1",
indexId = 3,
markerTable = "cohort_2",
markerId = 1,
combinationWindow = c(0,365)
name = "joined_cohorts",
indexTable ="cohort_1",
indexId = 3,
markerTable = "cohort_2",
markerId = 1,
combinationWindow = c(0,365)
)
loc <- cdm$joined_cohorts %>%
dplyr::inner_join(CDMConnector::settings(cdm$joined_cohorts), by = "cohort_definition_id", copy = T) %>%
Expand Down Expand Up @@ -561,28 +562,28 @@ test_that("tests involving washout", {
cdm$joined_cohorts %>% dplyr::pull(marker_date) == earliest_marker_date))

cdm <- generateSequenceCohortSet(cdm,
name = "joined_cohorts",
indexTable ="cohort_1",
markerTable = "cohort_2"
name = "joined_cohorts",
indexTable ="cohort_1",
markerTable = "cohort_2"
)
expect_true(cdm$joined_cohorts %>% dplyr::tally() %>% dplyr::pull(n) == 0) #combinationWindow fails

cdm <- generateSequenceCohortSet(cdm,
name = "joined_cohorts",
indexTable ="cohort_1",
markerTable = "cohort_2",
daysPriorObservation = 3650,
combinationWindow = c(0, Inf)
name = "joined_cohorts",
indexTable ="cohort_1",
markerTable = "cohort_2",
daysPriorObservation = 3650,
combinationWindow = c(0, Inf)
)
expect_true(cdm$joined_cohorts %>% dplyr::tally() %>% dplyr::pull(n) == 0) #insufficient prior_obs

cdm <- generateSequenceCohortSet(cdm,
name = "joined_cohorts",
cohortDateRange = as.Date(c("2000-01-01", NA)),
indexTable ="cohort_1",
markerTable = "cohort_2",
daysPriorObservation = 0,
combinationWindow = c(0,Inf)
name = "joined_cohorts",
cohortDateRange = as.Date(c("2000-01-01", NA)),
indexTable ="cohort_1",
markerTable = "cohort_2",
daysPriorObservation = 0,
combinationWindow = c(0,Inf)
)
expect_true(cdm$joined_cohorts %>% dplyr::tally() %>% dplyr::pull(n) == 1)
expect_true(cdm$joined_cohorts %>% dplyr::pull(cohort_start_date) >= as.Date("2000-01-01"))
Expand Down Expand Up @@ -701,6 +702,7 @@ test_that("tests involving washout", {

########################### Involving indexMarkerGap ########################
test_that("tests involving indexMarkerGap", {
skip_on_cran()
indexCohort <- dplyr::tibble(
cohort_definition_id = c(1, 1, 1, 1),
subject_id = c(1, 1, 2, 2),
Expand Down
7 changes: 2 additions & 5 deletions tests/testthat/test-summariseSequenceRatios.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test_that("summariseSequenceRatios", {
)

cdm <- mockCohortSymmetry(indexCohort = indexCohort,
markerCohort = markerCohort)
markerCohort = markerCohort)

cdm <- generateSequenceCohortSet(cdm = cdm,
name = "joined_cohorts",
Expand All @@ -45,10 +45,6 @@ test_that("summariseSequenceRatios", {
summariseSequenceRatios(
cohort = cdm$joined_cohorts2)
)
expect_error(
summariseSequenceRatios(
cohort = cdm2$joined_cohorts)
)
expect_error(
summariseSequenceRatios(
cohort = cdm$joined_cohorts,
Expand All @@ -66,6 +62,7 @@ test_that("summariseSequenceRatios", {
})

test_that("summariseSequenceRatios - testing ratios and CIs, Example 1", {
skip_on_cran()
indexCohort <- dplyr::tibble(
cohort_definition_id = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2),
subject_id = c(1, 4, 2, 3, 5, 5, 4, 3, 6, 1),
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-summariseTemporalSymmetry.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ test_that("test summariseTemporalSymmetry", {
})

test_that("test cohortId",{
skip_on_cran()
cdm <- mockCohortSymmetry()
cdm <- generateSequenceCohortSet(
cdm = cdm,
Expand Down

0 comments on commit 4dbc273

Please sign in to comment.