Skip to content

Commit

Permalink
Work around test failure for dev dbplyr
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Feb 3, 2022
1 parent 4738b61 commit 6d12d85
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/testthat/test-rows-db.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,32 +88,32 @@ test_that("insert + delete with returning argument (#607)", {
test_that("insert + delete with returning argument and in_place = FALSE", {
target <- test_db_src_frame(select = 1:3, where = letters[c(1:2, NA)], exists = 0.5 + 0:2)

expect_equal(
rows_insert(target, test_db_src_frame(select = 4, where = "z"), in_place = FALSE, returning = quote(everything())) %>%
get_returned_rows(),
tibble(select = 4L, where = "z", exists = NA_real_)
)

expect_equal(
rows_delete(target, test_db_src_frame(select = 3:4, where = "z"), in_place = FALSE, returning = quote(everything())) %>%
get_returned_rows(),
tibble(select = 3L, where = NA_character_, exists = 2.5)
)
})

test_that("insert + delete with returning argument and in_place = FALSE", {
target <- test_db_src_frame(select = 1:3, where = letters[c(1:2, NA)], exists = 0.5 + 0:2)

skip_if_src(c("df", "sqlite"))
skip_if(packageVersion("dbplyr") > "2.1.1")
expect_equal(
rows_insert(target, test_db_src_frame(select = 4, where = "z"), in_place = FALSE, returning = quote(everything())) %>%
get_returned_rows(),
tibble(select = 4L, where = "z", exists = NA_real_)
)
})

test_that("insert + delete with returning argument and in_place = FALSE, SQLite variant", {
target <- test_db_src_frame(select = 1:3, where = letters[c(1:2, NA)], exists = 0.5 + 0:2)

# Introduced in https://github.com/tidyverse/dbplyr/commit/ebe9a079a56522abb6f919bf42105ae05ca87951,
# sqlite isn't type stable, perhaps the underlying query has changed in a subtle way
skip_if_src_not(c("df", "sqlite"))
skip_if(packageVersion("dbplyr") <= "2.1.1")
expect_equal(
rows_delete(target, test_db_src_frame(select = 3:4, where = "z"), in_place = FALSE, returning = quote(everything())) %>%
rows_insert(target, test_db_src_frame(select = 4, where = "z"), in_place = FALSE, returning = quote(everything())) %>%
get_returned_rows(),
tibble(select = 3L, where = NA_character_, exists = 2.5)
tibble(select = 4L, where = "z", exists = NA)
)
})

Expand Down

0 comments on commit 6d12d85

Please sign in to comment.