-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
DBItest/R/spec-result-roundtrip.R
Line 333 in f19fb4d
| eval(bquote(expect_identical(rows[1L, .(i)], .(value_or_testfun)))) |
We have a backend that always returns tbl_df/tbl/data.frame, which uses drop=FALSE by default, however, that runs into issues here (and perhaps other places?) where it's assumed that [ has drop=TRUE when doing rows[1,1], e.g.
── Failure: DBItest: Result: data_logical ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
rows[1L, 2L] (`actual`) not identical to FALSE (`expected`).
`actual` is an S3 object of class <tbl_df/tbl/data.frame>, a list
`expected` is a logical vector (FALSE)
Backtrace:
▆
1. └─DBItest:::spec_result$data_logical(ctx = ctx, con = global_con)
2. └─DBItest:::test_select_with_null(...) at rbuild/R/spec-result-roundtrip.R:29:5
3. └─DBItest:::test_select(..., .add_null = "below") at rbuild/R/spec-result-roundtrip.R:264:3
4. ├─base::eval(bquote(expect_identical(rows[1L, .(i)], .(value_or_testfun)))) at rbuild/R/spec-result-roundtrip.R:333:7
5. │ └─base::eval(bquote(expect_identical(rows[1L, .(i)], .(value_or_testfun))))
6. └─testthat::expect_identical(rows[1L, 2L], FALSE)
Is it safe to always do drop=TRUE here, or should we just keep skipping this test under "only data.frame returns are supported"?
I lean towards the former, because check_df() has several checks, none of which requires exact [.data.frame syntax:
DBItest/R/spec-result-roundtrip.R
Line 317 in f19fb4d
| rows <- check_df(dbGetQuery(con, query)) |
Lines 78 to 91 in f19fb4d
| check_df <- function(df) { | |
| expect_s3_class(df, "data.frame") | |
| if (length(df) >= 1L) { | |
| lengths <- unname(lengths(df)) | |
| expect_equal(diff(lengths), rep(0L, length(lengths) - 1L)) | |
| expect_equal(nrow(df), lengths[[1]]) | |
| } | |
| df_names <- names(df) | |
| expect_true(all(df_names != "")) | |
| expect_false(anyNA(df_names)) | |
| df | |
| } |
Metadata
Metadata
Assignees
Labels
No labels