Skip to content

Commit

Permalink
[188037693]: fixes for integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gergness committed Aug 6, 2024
1 parent 6bfc939 commit 31ef3f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion R/as-data-frame.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ csvColInfo <- function(ds, verbose = TRUE) {
alias_info <- paste0(out$orig_alias[msg_rows], " -> ", out$cond_qualified_alias[msg_rows])

Check warning on line 162 in R/as-data-frame.R

View workflow job for this annotation

GitHub Actions / test-coverage

file=R/as-data-frame.R,line=162,col=101,[line_length_linter] Lines should not be more than 100 characters. This line is 102 characters.
message(
"Some column names are qualified because there were duplicate aliases ",
"in dataset: ", paste0(alias_info, collapse = ", ")
"in dataset:\n", paste0(alias_info, collapse = ", ")
)
}
}
Expand Down
27 changes: 14 additions & 13 deletions tests/testthat/test-as-data-frame.R
Original file line number Diff line number Diff line change
Expand Up @@ -379,16 +379,10 @@ with_test_authentication({
df <- as.data.frame(ds, force = TRUE, include.hidden = FALSE)
expect_equal(names(df), c("v1", "v2", "v3", "v4", "v5", "vee six !"))

expect_warning(
df <- as.data.frame(ds, force = TRUE, include.hidden = TRUE),
"Variable hidden_var is hidden"
)
df <- as.data.frame(ds, force = TRUE, include.hidden = TRUE)
expect_equal(names(df), c("v1", "v2", "v3", "v4", "v5", "vee six !", "hidden_var"))

expect_warning(
df <- as.data.frame(ds[, c("v1", "hidden_var")], force = TRUE),
"Variable hidden_var is hidden"
)
df <- as.data.frame(ds[, c("v1", "hidden_var")], force = TRUE)
expect_equal(names(df), c("v1", "hidden_var"))
})

Expand All @@ -397,13 +391,20 @@ with_test_authentication({
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")
VarDef(mrds$MR$mr_1, name = "dup mr_1", alias = "mr_1"),
VarDef(mrds$MR$mr_2, name = "dup v4", alias = "v4")
),
name = "MR 2"
name = "MR 2", numeric = FALSE
)
mrds_df <- as.data.frame(mrds, force = TRUE)
expect_equal(ncol(mrds_df), 4)
expect_message(
mrds_df <- as.data.frame(mrds, force = TRUE),
paste0(
"Some column names are qualified because there were duplicate aliases ",
"in dataset:\nmr_1 -> MR[mr_1], mr_1 -> MR2[mr_1], v4 -> MR2[v4]"
)
)

expect_equal(ncol(mrds_df), 6)
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))
Expand Down

0 comments on commit 31ef3f2

Please sign in to comment.