Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Imports:
methods,
nanoarrow,
palmerpenguins,
purrr,
rlang (>= 0.2.0),
testthat (>= 2.0.0),
utils,
Expand Down
12 changes: 6 additions & 6 deletions R/expectations.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ expect_all_args_have_default_values <- function(object) {
act <- quasi_label(enquo(object), arg = "object")
act$args <- formals(act$val)
act$args <- act$args[names(act$args) != "..."]
act$char_args <- map_chr(act$args, as.character)
act$char_args <- purrr::map_chr(act$args, as.character)
expect(
all(nzchar(act$char_args, keepNA = FALSE)),
sprintf("%s has arguments without default values", act$lab)
Expand Down Expand Up @@ -48,13 +48,13 @@ expect_invisible_true <- function(code) {
}

expect_equal_df <- function(actual, expected) {
factor_cols <- map_lgl(expected, is.factor)
expected[factor_cols] <- map(expected[factor_cols], as.character)
factor_cols <- purrr::map_lgl(expected, is.factor)
expected[factor_cols] <- purrr::map(expected[factor_cols], as.character)

asis_cols <- map_lgl(expected, inherits, "AsIs")
expected[asis_cols] <- map(expected[asis_cols], unclass)
asis_cols <- purrr::map_lgl(expected, inherits, "AsIs")
expected[asis_cols] <- purrr::map(expected[asis_cols], unclass)

list_cols <- map_lgl(expected, is.list)
list_cols <- purrr::map_lgl(expected, is.list)

if (any(list_cols)) {
expect_false(all(list_cols))
Expand Down
6 changes: 3 additions & 3 deletions R/run.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ get_skip_names <- function(skip) {
}
names_all <- names(spec_all)
names_all <- names_all[names_all != ""]
skip_flags_all <- map(paste0("(?:^(?:", skip, ")(?:|_[0-9]+)$)"), grepl, names_all, perl = TRUE)
skip_used <- map_lgl(skip_flags_all, any)
skip_flags_all <- purrr::map(paste0("(?:^(?:", skip, ")(?:|_[0-9]+)$)"), grepl, names_all, perl = TRUE)
skip_used <- purrr::map_lgl(skip_flags_all, any)
if (!all(skip_used)) {
warning("These skip expressions did not match any test names: ", toString(skip[!skip_used]),
call. = FALSE
Expand All @@ -129,7 +129,7 @@ get_run_only_tests <- function(tests, run_only) {
return(tests)
}

run_only_flags_all <- map(paste0("(?:^(?:", run_only, ")$)"), grepl, names_all, perl = TRUE)
run_only_flags_all <- purrr::map(paste0("(?:^(?:", run_only, ")$)"), grepl, names_all, perl = TRUE)
run_only_flag_all <- Reduce(`|`, run_only_flags_all)
run_only_tests <- names_all[run_only_flag_all]

Expand Down
12 changes: 6 additions & 6 deletions R/spec-arrow-append-table-arrow.R
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ spec_arrow_append_table_arrow <- list(
use_append = TRUE,
con, tbl_in,
transform = function(out) {
dates <- map_lgl(out, inherits, "POSIXt")
dates <- purrr::map_lgl(out, inherits, "POSIXt")
tz <- toupper(names(out))
tz[tz == "LOCAL"] <- ""
out[dates] <- Map(lubridate::with_tz, out[dates], tz[dates])
Expand Down Expand Up @@ -452,7 +452,7 @@ spec_arrow_append_table_arrow <- list(
use_append = TRUE,
con, tbl_in,
transform = function(out) {
dates <- map_lgl(out, inherits, "POSIXt")
dates <- purrr::map_lgl(out, inherits, "POSIXt")
tz <- toupper(names(out))
tz[tz == "LOCAL"] <- ""
out[dates] <- Map(lubridate::with_tz, out[dates], tz[dates])
Expand All @@ -465,16 +465,16 @@ spec_arrow_append_table_arrow <- list(
arrow_append_table_arrow_roundtrip_mixed = function(con) {
#' Mixing column types in the same table is supported.
data <- list("a", 1L, 1.5)
data <- map(data, c, NA)
data <- purrr::map(data, c, NA)
expanded <- expand.grid(a = data, b = data, c = data)
tbl_in_list <- map(
tbl_in_list <- purrr::map(
seq_len(nrow(expanded)),
function(i) {
data.frame(map(expanded[i, ], unlist, recursive = FALSE))
data.frame(purrr::map(expanded[i, ], unlist, recursive = FALSE))
}
)

map(tbl_in_list, test_arrow_roundtrip, con = con)
purrr::map(tbl_in_list, test_arrow_roundtrip, con = con)
},

arrow_append_table_arrow_name = function(ctx, con) {
Expand Down
12 changes: 6 additions & 6 deletions R/spec-arrow-write-table-arrow.R
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ spec_arrow_write_table_arrow <- list(
test_arrow_roundtrip(
con, tbl_in,
transform = function(out) {
dates <- map_lgl(out, inherits, "POSIXt")
dates <- purrr::map_lgl(out, inherits, "POSIXt")
tz <- toupper(names(out))
tz[tz == "LOCAL"] <- ""
out[dates] <- Map(lubridate::with_tz, out[dates], tz[dates])
Expand Down Expand Up @@ -685,7 +685,7 @@ spec_arrow_write_table_arrow <- list(
test_arrow_roundtrip(
con, tbl_in,
transform = function(out) {
dates <- map_lgl(out, inherits, "POSIXt")
dates <- purrr::map_lgl(out, inherits, "POSIXt")
tz <- toupper(names(out))
tz[tz == "LOCAL"] <- ""
out[dates] <- Map(lubridate::with_tz, out[dates], tz[dates])
Expand All @@ -698,16 +698,16 @@ spec_arrow_write_table_arrow <- list(
arrow_write_table_arrow_roundtrip_mixed = function(ctx, con) {
#' Mixing column types in the same table is supported.
data <- list("a", 1L, 1.5)
data <- map(data, c, NA)
data <- purrr::map(data, c, NA)
expanded <- expand.grid(a = data, b = data, c = data)
tbl_in_list <- map(
tbl_in_list <- purrr::map(
seq_len(nrow(expanded)),
function(i) {
as.data.frame(map(expanded[i, ], unlist, recursive = FALSE))
as.data.frame(purrr::map(expanded[i, ], unlist, recursive = FALSE))
}
)

map(tbl_in_list, test_arrow_roundtrip, con = con)
purrr::map(tbl_in_list, test_arrow_roundtrip, con = con)
},

#
Expand Down
4 changes: 2 additions & 2 deletions R/spec-arrow.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ utils::globalVariables("select")

stream_frame <- function(..., .select = NULL) {
data <- data.frame(..., stringsAsFactors = FALSE, check.names = FALSE)
as_is <- map_lgl(data, inherits, "AsIs")
data[as_is] <- map(data[as_is], function(.x) {
as_is <- purrr::map_lgl(data, inherits, "AsIs")
data[as_is] <- purrr::map(data[as_is], function(.x) {
class(.x) <- setdiff(class(.x), "AsIs")
.x
})
Expand Down
4 changes: 2 additions & 2 deletions R/spec-driver-data-type.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ test_data_type <- function(ctx, dbObj) {
}
)

map(
purrr::map(
compact(expected_data_types),
expect_has_data_type
)
Expand All @@ -96,7 +96,7 @@ test_data_type <- function(ctx, dbObj) {

#' As-is objects (i.e., wrapped by [I()]) must be
#' supported and return the same results as their unwrapped counterparts.
map(
purrr::map(
compact(expected_data_types),
function(value) {
if (!is.null(value)) {
Expand Down
6 changes: 3 additions & 3 deletions R/spec-meta-bind-.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ test_select_bind_expr <- function(
get_placeholder_funs <- function(ctx, requires_names = NULL) {
placeholder_fun <- ctx$tweaks$placeholder_pattern
if (is.character(placeholder_fun)) {
placeholder_funs <- map(placeholder_fun, make_placeholder_fun)
placeholder_funs <- purrr::map(placeholder_fun, make_placeholder_fun)
} else if (is.function(placeholder_fun)) {
placeholder_funs <- list(placeholder_fun)
} else {
Expand All @@ -90,8 +90,8 @@ get_placeholder_funs <- function(ctx, requires_names = NULL) {
}

if (!is.null(requires_names)) {
placeholder_fun_values <- map(placeholder_funs, ~ .x(1))
placeholder_unnamed <- map_lgl(placeholder_fun_values, ~ is.null(names(.x)))
placeholder_fun_values <- purrr::map(placeholder_funs, ~ .x(1))
placeholder_unnamed <- purrr::map_lgl(placeholder_fun_values, ~ is.null(names(.x)))

# run_bind_tester$fun()
if (isTRUE(requires_names)) {
Expand Down
Loading
Loading