Skip to content

Commit

Permalink
correct tests for sorting & attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
zander-prinsloo committed May 22, 2024
1 parent d7a045b commit 72d4195
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions tests/testthat/test-dplyr-joins.R
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,8 @@ test_that("FULL JOIN - Conducts full join", {
x4,
y4,
by = c("id1 = id2"),
relationship = "many-to-many"
relationship = "many-to-many",
sort = TRUE
)
#dplyr::full_join(x4, y4, by = dplyr::join_by(id1 == id2), relationship = "many-to-many")
jn_dplyr <- dplyr::full_join(
Expand All @@ -879,9 +880,9 @@ test_that("FULL JOIN - Conducts full join", {
by = dplyr::join_by(id1 == id2),
relationship = "many-to-many"
)
attr(jn_dplyr, "sorted") <- "id1"
attr(jn_joyn,
"sorted") <- "id"
# attr(jn_dplyr, "sorted") <- "id1"
# attr(jn_joyn,
# "sorted") <- "id"
expect_equal(
jn |> fselect(-get(reportvar)),
jn_dplyr,
Expand Down Expand Up @@ -1703,13 +1704,14 @@ test_that("ANTI JOIN - Conducts ANTI join", {
jn_joyn <- anti_join(
x = x1,
y = y1,
by = "id"
by = "id",
sort = TRUE
)

jn_dplyr <- dplyr::anti_join(
x1, y1, by = "id"
x1, y1, by = "id", s
)
setorder(jn_dplyr, na.last = F)

attr(
jn_dplyr,
"sorted"
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-merge-data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ test_that("FULL JOIN - Conducts full join", {
by.y = "id2",
all = TRUE
)

attr(jn_dt, 'sorted') <- NULL

expect_equal(
jn |> fselect(-get(reportvar)),
Expand Down

0 comments on commit 72d4195

Please sign in to comment.