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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to