Skip to content

Commit

Permalink
test: Adapt tests to constructive updates
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Dec 7, 2024
1 parent 5cb571b commit 917c983
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 64 deletions.
48 changes: 24 additions & 24 deletions R/spec-meta-bind-arrow-stream.R
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ spec_meta_arrow_stream_bind <- list(
placeholder_funs <- get_placeholder_funs(ctx, requires_names = TRUE)
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(data.frame(1.5, 2.5, 3.5, NA_real_, check.names = FALSE), names = rep("", 4L))
bind_values <- structure(data.frame(1.5, 2.5, 3.5, NA_real_, check.names = FALSE), names = character(4))
placeholder <- placeholder_fun(4L)
names(bind_values) <- names(placeholder)
bind_values_patched <- bind_values[c(3, 1, 2, 4)]
Expand All @@ -337,7 +337,7 @@ spec_meta_arrow_stream_bind <- list(
placeholder_funs <- get_placeholder_funs(ctx)
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(data.frame(1L, 2L, 3L, NA_integer_, check.names = FALSE), names = rep("", 4L))
bind_values <- structure(data.frame(1L, 2L, 3L, NA_integer_, check.names = FALSE), names = character(4))
placeholder <- placeholder_fun(4L)
names(bind_values) <- names(placeholder)
placeholder_values <- map_chr(bind_values, function(x) DBI::dbQuoteLiteral(con, x[1]))
Expand Down Expand Up @@ -365,7 +365,7 @@ spec_meta_arrow_stream_bind <- list(
placeholder_funs <- get_placeholder_funs(ctx)
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(data.frame(1.5, 2.5, 3.5, NA_real_, check.names = FALSE), names = rep("", 4L))
bind_values <- structure(data.frame(1.5, 2.5, 3.5, NA_real_, check.names = FALSE), names = character(4))
placeholder <- placeholder_fun(4L)
names(bind_values) <- names(placeholder)
placeholder_values <- map_chr(bind_values, function(x) DBI::dbQuoteLiteral(con, x[1]))
Expand Down Expand Up @@ -393,7 +393,7 @@ spec_meta_arrow_stream_bind <- list(
placeholder_funs <- get_placeholder_funs(ctx)
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(data.frame(TRUE, FALSE, NA, check.names = FALSE), names = rep("", 3L))
bind_values <- structure(data.frame(TRUE, FALSE, NA, check.names = FALSE), names = character(3))
placeholder <- placeholder_fun(3L)
names(bind_values) <- names(placeholder)
placeholder_values <- map_chr(bind_values, function(x) DBI::dbQuoteLiteral(con, x[1]))
Expand Down Expand Up @@ -421,8 +421,8 @@ spec_meta_arrow_stream_bind <- list(
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(
data.frame("\U{41A}\U{438}\U{440}\U{438}\U{43B}\U{43B}", "M\U{FC}ller", "M\U{FC}ller", "\U{6211}\U{662F}\U{8C01}", "ASCII", NA_character_, check.names = FALSE),
names = rep("", 6L)
data.frame("\U{41A}\U{438}\U{440}\U{438}\U{43B}\U{43B}", "M\U{FC}ller", `Encoding<-`("M\xfcller", "latin1"), "\U{6211}\U{662F}\U{8C01}", "ASCII", NA_character_, check.names = FALSE),
names = character(6)
)
placeholder <- placeholder_fun(6L)
names(bind_values) <- names(placeholder)
Expand Down Expand Up @@ -455,7 +455,7 @@ spec_meta_arrow_stream_bind <- list(
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(
data.frame(" ", "\n", "\r", "\b", "'", '"', "[", "]", "\\", NA_character_, check.names = FALSE),
names = rep("", 10L)
names = character(10)
)
placeholder <- placeholder_fun(10L)
names(bind_values) <- names(placeholder)
Expand Down Expand Up @@ -492,8 +492,8 @@ spec_meta_arrow_stream_bind <- list(
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(
data.frame(factor("\U{41A}\U{438}\U{440}\U{438}\U{43B}\U{43B}"), factor("M\U{FC}ller"), factor("M\U{FC}ller"), factor("\U{6211}\U{662F}\U{8C01}"), factor("ASCII"), factor(NA_character_), check.names = FALSE),
names = rep("", 6L)
data.frame(factor("\U{41A}\U{438}\U{440}\U{438}\U{43B}\U{43B}"), factor("M\U{FC}ller"), factor(`Encoding<-`("M\xfcller", "latin1")), factor("\U{6211}\U{662F}\U{8C01}"), factor("ASCII"), factor(NA_character_), check.names = FALSE),
names = character(6)
)
placeholder <- placeholder_fun(6L)
names(bind_values) <- names(placeholder)
Expand Down Expand Up @@ -526,8 +526,8 @@ spec_meta_arrow_stream_bind <- list(
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(
data.frame(as.Date("2023-12-17"), as.Date("2023-12-18"), as.Date("2023-12-19"), as.Date(NA_character_), check.names = FALSE),
names = rep("", 4L)
data.frame(as.Date("2023-12-17"), as.Date("2023-12-18"), as.Date("2023-12-19"), as.Date(NA), check.names = FALSE),
names = character(4)
)
placeholder <- placeholder_fun(4L)
names(bind_values) <- names(placeholder)
Expand Down Expand Up @@ -559,7 +559,7 @@ spec_meta_arrow_stream_bind <- list(
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(
data.frame(structure(18618L, class = "Date"), structure(18619L, class = "Date"), structure(18620L, class = "Date"), structure(NA_integer_, class = "Date"), check.names = FALSE),
names = rep("", 4L)
names = character(4)
)
placeholder <- placeholder_fun(4L)
names(bind_values) <- names(placeholder)
Expand Down Expand Up @@ -591,7 +591,7 @@ spec_meta_arrow_stream_bind <- list(
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(
data.frame(as.POSIXct("2023-12-17 02:40:22"), as.POSIXct("2023-12-17 02:40:23"), as.POSIXct("2023-12-17 02:40:24"), as.POSIXct(NA_character_), check.names = FALSE),
names = rep("", 4L)
names = character(4)
)
placeholder <- placeholder_fun(4L)
names(bind_values) <- names(placeholder)
Expand Down Expand Up @@ -623,7 +623,7 @@ spec_meta_arrow_stream_bind <- list(
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(
data.frame(as.POSIXct("2023-12-17 02:40:49"), as.POSIXct("2023-12-17 02:40:50"), as.POSIXct("2023-12-17 02:40:51"), as.POSIXct(NA_character_), check.names = FALSE),
names = rep("", 4L)
names = character(4)
)
placeholder <- placeholder_fun(4L)
names(bind_values) <- names(placeholder)
Expand Down Expand Up @@ -654,8 +654,8 @@ spec_meta_arrow_stream_bind <- list(
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(
data.frame(structure(1, class = "difftime", units = "secs"), structure(2, class = "difftime", units = "secs"), structure(3, class = "difftime", units = "secs"), structure(NA_real_, class = "difftime", units = "secs"), check.names = FALSE),
names = rep("", 4L)
data.frame(as.difftime(1, units = "secs"), as.difftime(2, units = "secs"), as.difftime(3, units = "secs"), as.difftime(NA_real_, units = "secs"), check.names = FALSE),
names = character(4)
)
placeholder <- placeholder_fun(4L)
names(bind_values) <- names(placeholder)
Expand Down Expand Up @@ -686,8 +686,8 @@ spec_meta_arrow_stream_bind <- list(
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(
data.frame(structure(1, class = "difftime", units = "hours"), structure(2, class = "difftime", units = "hours"), structure(3, class = "difftime", units = "hours"), structure(NA_real_, class = "difftime", units = "hours"), check.names = FALSE),
names = rep("", 4L)
data.frame(as.difftime(1, units = "hours"), as.difftime(2, units = "hours"), as.difftime(3, units = "hours"), as.difftime(NA_real_, units = "hours"), check.names = FALSE),
names = character(4)
)
placeholder <- placeholder_fun(4L)
names(bind_values) <- names(placeholder)
Expand Down Expand Up @@ -718,8 +718,8 @@ spec_meta_arrow_stream_bind <- list(
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(
data.frame(structure(1, class = "difftime", units = "mins"), structure(2, class = "difftime", units = "mins"), structure(3, class = "difftime", units = "mins"), structure(NA_real_, class = "difftime", units = "mins"), check.names = FALSE),
names = rep("", 4L)
data.frame(as.difftime(1, units = "mins"), as.difftime(2, units = "mins"), as.difftime(3, units = "mins"), as.difftime(NA_real_, units = "mins"), check.names = FALSE),
names = character(4)
)
placeholder <- placeholder_fun(4L)
names(bind_values) <- names(placeholder)
Expand Down Expand Up @@ -752,13 +752,13 @@ spec_meta_arrow_stream_bind <- list(
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(
list(
structure(vctrs::list_of(as.raw(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)), .ptype = raw(0)), class = c("blob", "vctrs_list_of", "vctrs_vctr", "list")),
structure(vctrs::list_of(raw(3), .ptype = raw(0)), class = c("blob", "vctrs_list_of", "vctrs_vctr", "list")),
blob::blob(as.raw(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))),
blob::blob(raw(3)),
structure(vctrs::list_of(NULL, .ptype = raw(0)), class = c("blob", "vctrs_list_of", "vctrs_vctr", "list"))
),
names = rep("", 3L),
names = character(3),
class = "data.frame",
row.names = 1L
row.names = c(NA, -1L)
)
placeholder <- placeholder_fun(3L)
names(bind_values) <- names(placeholder)
Expand Down
16 changes: 8 additions & 8 deletions R/spec-meta-bind-arrow.R
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ spec_meta_arrow_bind <- list(
placeholder_funs <- get_placeholder_funs(ctx)
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- c("\U{41A}\U{438}\U{440}\U{438}\U{43B}\U{43B}", "M\U{FC}ller", "M\U{FC}ller", "\U{6211}\U{662F}\U{8C01}", "ASCII", NA)
bind_values <- c("\U{41A}\U{438}\U{440}\U{438}\U{43B}\U{43B}", "M\U{FC}ller", `Encoding<-`("M\xfcller", "latin1"), "\U{6211}\U{662F}\U{8C01}", "ASCII", NA)
placeholder <- placeholder_fun(6L)
names(bind_values) <- names(placeholder)
placeholder_values <- map_chr(bind_values, function(x) DBI::dbQuoteLiteral(con, x[1]))
Expand Down Expand Up @@ -514,7 +514,7 @@ spec_meta_arrow_bind <- list(
placeholder_funs <- get_placeholder_funs(ctx)
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- list(factor("\U{41A}\U{438}\U{440}\U{438}\U{43B}\U{43B}"), factor("M\U{FC}ller"), factor("M\U{FC}ller"), factor("\U{6211}\U{662F}\U{8C01}"), factor("ASCII"), factor(NA_character_))
bind_values <- list(factor("\U{41A}\U{438}\U{440}\U{438}\U{43B}\U{43B}"), factor("M\U{FC}ller"), factor(`Encoding<-`("M\xfcller", "latin1")), factor("\U{6211}\U{662F}\U{8C01}"), factor("ASCII"), factor(NA_character_))
placeholder <- placeholder_fun(6L)
names(bind_values) <- names(placeholder)
placeholder_values <- map_chr(bind_values, function(x) DBI::dbQuoteLiteral(con, x[1]))
Expand Down Expand Up @@ -632,7 +632,7 @@ spec_meta_arrow_bind <- list(
placeholder_funs <- get_placeholder_funs(ctx)
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- list(structure(as.POSIXlt(as.POSIXct("2023-12-17 02:40:49")), balanced = TRUE), structure(as.POSIXlt(as.POSIXct("2023-12-17 02:40:50")), balanced = TRUE), structure(as.POSIXlt(as.POSIXct("2023-12-17 02:40:51")), balanced = TRUE), structure(as.POSIXlt(NA_character_), balanced = TRUE))
bind_values <- list(as.POSIXlt("2023-12-17 02:40:49"), as.POSIXlt("2023-12-17 02:40:50"), as.POSIXlt("2023-12-17 02:40:51"), as.POSIXlt(NA_character_))
placeholder <- placeholder_fun(4L)
names(bind_values) <- names(placeholder)
placeholder_values <- map_chr(bind_values, function(x) DBI::dbQuoteLiteral(con, x[1]))
Expand Down Expand Up @@ -661,7 +661,7 @@ spec_meta_arrow_bind <- list(
placeholder_funs <- get_placeholder_funs(ctx)
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(c(1, 2, 3, NA), class = "difftime", units = "secs")
bind_values <- as.difftime(c(1, 2, 3, NA), units = "secs")
placeholder <- placeholder_fun(4L)
names(bind_values) <- names(placeholder)
placeholder_values <- map_chr(bind_values, function(x) DBI::dbQuoteLiteral(con, x[1]))
Expand Down Expand Up @@ -690,7 +690,7 @@ spec_meta_arrow_bind <- list(
placeholder_funs <- get_placeholder_funs(ctx)
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(c(1, 2, 3, NA), class = "difftime", units = "hours")
bind_values <- as.difftime(c(1, 2, 3, NA), units = "hours")
placeholder <- placeholder_fun(4L)
names(bind_values) <- names(placeholder)
placeholder_values <- map_chr(bind_values, function(x) DBI::dbQuoteLiteral(con, x[1]))
Expand Down Expand Up @@ -719,7 +719,7 @@ spec_meta_arrow_bind <- list(
placeholder_funs <- get_placeholder_funs(ctx)
is_null_check <- ctx$tweaks$is_null_check
for (placeholder_fun in placeholder_funs) {
bind_values <- structure(c(1, 2, 3, NA), class = "difftime", units = "mins")
bind_values <- as.difftime(c(1, 2, 3, NA), units = "mins")
placeholder <- placeholder_fun(4L)
names(bind_values) <- names(placeholder)
placeholder_values <- map_chr(bind_values, function(x) DBI::dbQuoteLiteral(con, x[1]))
Expand Down Expand Up @@ -780,8 +780,8 @@ spec_meta_arrow_bind <- list(
cast_fun <- ctx$tweaks$blob_cast
for (placeholder_fun in placeholder_funs) {
bind_values <- list(
structure(vctrs::list_of(as.raw(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)), .ptype = raw(0)), class = c("blob", "vctrs_list_of", "vctrs_vctr", "list")),
structure(vctrs::list_of(raw(3), .ptype = raw(0)), class = c("blob", "vctrs_list_of", "vctrs_vctr", "list")),
blob::blob(as.raw(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))),
blob::blob(raw(3)),
structure(vctrs::list_of(NULL, .ptype = raw(0)), class = c("blob", "vctrs_list_of", "vctrs_vctr", "list"))
)
placeholder <- placeholder_fun(3L)
Expand Down
Loading

0 comments on commit 917c983

Please sign in to comment.