Skip to content

Commit

Permalink
[188532827]: fix broken integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gergness committed Nov 8, 2024
1 parent 9dfae49 commit 18f0a50
Show file tree
Hide file tree
Showing 7 changed files with 319 additions and 308 deletions.
2 changes: 1 addition & 1 deletion tests/testthat/test-append-debug.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
context("Debugging append")

with_test_authentication({
with(temp.option(crunch = list(crunch.timeout = 60)), {
with(temp.option(crunch = list(crunch.timeout = 60, crunch.default.derived = TRUE)), {
whereas("Appending with an exclusion on the incoming dataset", {
part0 <- createDataset(name = now())
part1 <- newDatasetFromFixture("apidocs")
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-combine-categories.R
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ with_test_authentication({
ds <- newDatasetFromFixture("apidocs")
ds$combined_pets <- combine(ds$q1,
name = "Pets (combined)",
derived = TRUE,
list(list(name = "Mammals", categories = c("Cat", "Dog")))
)
test_that("We can create a new categorical by combining", {
Expand Down
18 changes: 12 additions & 6 deletions tests/testthat/test-derive-array.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ with_test_authentication({
# Cat Dog Bird
# 6 4 6

vd <- deriveArray(list(ds$q1, ds$petloc$petloc_home), name = "Derived pets")
vd <- deriveArray(list(ds$q1, ds$petloc$petloc_home), name = "Derived pets", derived = TRUE)
test_that("deriveArray returns a VarDef", {
expect_is(vd, "VariableDefinition")
})
Expand All @@ -54,10 +54,12 @@ with_test_authentication({

ds$derivedmr <- deriveArray(
list(ds$q1, ds$petloc$petloc_home),
selections = "Dog", name = "Derived pets MR"
selections = "Dog", name = "Derived pets MR",
derived = TRUE
) # cat dog has id 2
test_that("deriveArray can also derive MRs", {
expect_true(is.MR(ds$derivedmr))
expect_true(is.derived(ds$derivedmr))
expect_identical(names(subvariables(ds$derivedmr)), c("Pet", "Home"))
expect_identical_temp_nodata(
names(categories(ds$derivedmr)),
Expand Down Expand Up @@ -112,13 +114,15 @@ with_test_authentication({
name = "Pet Location: Home", subreferences = list(
list(name = "Copy", alias = "pla_copy"),
list(name = "Original", alias = "pla_orig")
)
),
derived = TRUE
)
ds$petloc_b <- deriveArray(list(ds$petloc2$pl2_b, ds$petloc$petloc_work),
name = "Pet Location: Work", subreferences = list(
list(name = "Copy", alias = "plb_copy"),
list(name = "Original", alias = "plb_orig")
)
),
derived = TRUE
)

test_that("Deriving arrays with subreferences specified", {
Expand All @@ -137,7 +141,8 @@ with_test_authentication({
ds$petloc$petloc_home, ds$petloc_a$pla_copy,
ds$petloc_b$plb_copy, ds$derivedarray$dsub2
),
name = "Derived from derived and real"
name = "Derived from derived and real",
derived = TRUE
)
test_that("Derived arrays of derived array subvariables with different categories", {
expect_identical(
Expand All @@ -163,7 +168,8 @@ with_test_authentication({
combinations = list(
list(name = "Cat", categories = c("Cat", "one")),
list(name = "Dog", categories = c("Dog", "two"))
)
),
derived = TRUE
)
test_that("Combine categories of derived array", {
expect_identical(
Expand Down
Loading

0 comments on commit 18f0a50

Please sign in to comment.