Skip to content

Commit

Permalink
fix: arr$max and arr$min works without nightly feature
Browse files Browse the repository at this point in the history
  • Loading branch information
eitsupi committed Apr 16, 2024
1 parent fe57060 commit 37193fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 30 deletions.
8 changes: 2 additions & 6 deletions R/expr__array.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ ExprArr_sum = function() .pr$Expr$arr_sum(self)
#' @return Expr
#' @inherit ExprStr_to_titlecase details
#' @aliases arr_max
#' @examplesIf polars_info()$features$nightly
#' @examples
#' df = pl$DataFrame(
#' values = list(c(1, 2), c(3, 4), c(5, 6)),
#' schema = list(values = pl$Array(pl$Float64, 2))
#' )
#' df$with_columns(max = pl$col("values")$arr$max())
ExprArr_max = function() {
check_feature("nightly", "in $arr$max():")

.pr$Expr$arr_max(self)
}

Expand All @@ -38,15 +36,13 @@ ExprArr_max = function() {
#' @inherit ExprStr_to_titlecase details
#' @return Expr
#' @aliases arr_min
#' @examplesIf polars_info()$features$nightly
#' @examples
#' df = pl$DataFrame(
#' values = list(c(1, 2), c(3, 4), c(5, 6)),
#' schema = list(values = pl$Array(pl$Float64, 2))
#' )
#' df$with_columns(min = pl$col("values")$arr$min())
ExprArr_min = function() {
check_feature("nightly", "in $arr$min():")

.pr$Expr$arr_min(self)
}

Expand Down
24 changes: 0 additions & 24 deletions tests/testthat/test-expr_array.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ test_that("arr$sum", {


test_that("arr$max and arr$min", {
skip_if_not(polars_info()$features$nightly)

df = pl$DataFrame(
ints = list(1:2, c(1L, NA_integer_), c(NA_integer_, NA_integer_)),
floats = list(c(1, 2), c(1, NA_real_), c(NA_real_, NA_real_)),
Expand Down Expand Up @@ -50,28 +48,6 @@ test_that("arr$max and arr$min", {
)
})

test_that("arr$max and arr$min error if the nightly feature is false", {
skip_if(polars_info()$features$nightly)

df = pl$DataFrame(
ints = list(1:2, c(1L, NA_integer_), c(NA_integer_, NA_integer_)),
floats = list(c(1, 2), c(1, NA_real_), c(NA_real_, NA_real_)),
schema = list(
ints = pl$Array(pl$Int32, 2),
floats = pl$Array(pl$Float32, 2)
)
)
# max ---
expect_grepl_error(
df$select(pl$col("ints")$arr$max())$to_list()
)

# min ---
expect_grepl_error(
df$select(pl$col("ints")$arr$min())$to_list()
)
})

test_that("arr$reverse", {
df = pl$DataFrame(
a = list(c(Inf, 2, 2), c(4, NaN, 2)),
Expand Down

0 comments on commit 37193fc

Please sign in to comment.