Skip to content

Commit

Permalink
[188037693]: add integeration test for dup subvar aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
gergness committed Aug 5, 2024
1 parent 68541a7 commit 86efb32
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/testthat/test-as-data-frame.R
Original file line number Diff line number Diff line change
Expand Up @@ -395,13 +395,22 @@ with_test_authentication({
test_that("Multiple response variables in as.data.frame(force=TRUE)", {
skip_on_local_backend("Vagrant host doesn't serve files correctly")
mrds <- mrdf.setup(newDataset(mrdf, name = "test-mrdfmr"), selections = "1.0")
mrds$MR2 <- deriveArray(
list(
VarDef(ds$MR$mr_1, name = "dup mr_1", alias = "mr_1"),
VarDef(ds$MR$mr_2, name = "dup v4", alias = "v4")
),
name = "MR 2"
)
mrds_df <- as.data.frame(mrds, force = TRUE)
expect_equal(ncol(mrds_df), 4)
expect_equal(names(mrds_df), c("mr_1", "mr_2", "mr_3", "v4"))
expect_equal(mrds_df$mr_1, as.vector(mrds$MR$mr_1))
expect_equal(names(mrds_df), c("MR[mr_1]", "mr_2", "mr_3", "v4", "MR2[mr_1]", "MR2[v4]"))
expect_equal(mrds_df[["MR[mr_1]"]], as.vector(mrds$MR$mr_1))
expect_equal(mrds_df$mr_2, as.vector(mrds$MR$mr_2))
expect_equal(mrds_df$mr_3, as.vector(mrds$MR$mr_3))
expect_equal(mrds_df$v4, as.vector(mrds$v4))
expect_equal(mrds_df[["MR2[mr_1]"]], as.vector(mrds$MR2$mr_1))
expect_equal(mrds_df[["MR2[v4]"]], as.vector(mrds$MR2$v4))
})

v2 <- ds$v2
Expand Down

0 comments on commit 86efb32

Please sign in to comment.