Skip to content

Commit

Permalink
[188037693]: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gergness committed Aug 6, 2024
1 parent 4dc7ea0 commit 2283999
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions R/as-data-frame.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ csvColInfo <- function(ds, verbose = TRUE) {
if (any(msg_rows)) {
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 = ", ")
"Some column names are qualified because there were duplicate aliases",
"in dataset:\n", paste0(alias_info, collapse = ", ")
)
}
}
Expand Down
17 changes: 12 additions & 5 deletions tests/testthat/test-as-data-frame.R
Original file line number Diff line number Diff line change
Expand Up @@ -391,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 2283999

Please sign in to comment.