You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/07/12 20:18:42 UTC
[GitHub] [arrow] jonkeane commented on a change in pull request #10706: ARROW-12994: [R] Fix tests that assume UTC local tz
jonkeane commented on a change in pull request #10706:
URL: https://github.com/apache/arrow/pull/10706#discussion_r668227062
##########
File path: r/tests/testthat/test-compute-aggregate.R
##########
@@ -209,8 +209,20 @@ test_that("Edge cases", {
for (type in c(int32(), float64(), bool())) {
expect_equal(as.vector(sum(a$cast(type), na.rm = TRUE)), sum(NA, na.rm = TRUE))
expect_equal(as.vector(mean(a$cast(type), na.rm = TRUE)), mean(NA, na.rm = TRUE))
- expect_equal(as.vector(min(a$cast(type), na.rm = TRUE)), min(NA, na.rm = TRUE))
- expect_equal(as.vector(max(a$cast(type), na.rm = TRUE)), max(NA, na.rm = TRUE))
+ expect_warning(
+ expect_equal(
+ as.vector(min(a$cast(type), na.rm = TRUE)),
+ min(NA, na.rm = TRUE)
+ ),
+ "no non-missing arguments"
+ )
+ expect_warning(
+ expect_equal(
+ as.vector(max(a$cast(type), na.rm = TRUE)),
+ max(NA, na.rm = TRUE)
+ ),
+ "no non-missing arguments"
+ )
Review comment:
The warning that's being captured here is the base-R warning from `max(NA, na.rm = TRUE)` and we are not asserting that arrow will provide that warning (cause it does not as far as I can tell...)
It might be slightly clearer that our intention is that if we do:
```suggestion
expect_equal(
as.vector(min(a$cast(type), na.rm = TRUE)),
suppressWarnings(min(NA, na.rm = TRUE))
)
expect_equal(
as.vector(max(a$cast(type), na.rm = TRUE)),
suppressWarnings(max(NA, na.rm = TRUE))
)
```
Or put the `expect_warning()` inside of `expect_equal()`:
```
expect_equal(
as.vector(min(a$cast(type), na.rm = TRUE)),
expect_warning(min(NA, na.rm = TRUE), "no non-missing arguments")
)
expect_equal(
as.vector(max(a$cast(type), na.rm = TRUE)),
expect_warning(max(NA, na.rm = TRUE), "no non-missing arguments")
)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org