ianmcook commented on a change in pull request #9999:
URL: https://github.com/apache/arrow/pull/9999#discussion_r614239998
##########
File path: r/tests/testthat/test-dplyr-mutate.R
##########
@@ -415,3 +415,160 @@ test_that("mutate and write_dataset", {
summarize(mean = mean(integer))
)
})
+
+# PACHA ADDITIONS ----
+# READ THIS CAREFULLY PLEASE, IT'S MY 1ST DAY WRITING THIS KIND OF SENSITIVE
TESTS
+
+# similar to
https://github.com/tidyverse/dplyr/blob/master/tests/testthat/test-mutate.r#L1-L10
+# the rest of that test belongs in L55-62 here
+test_that("empty mutate returns input", {
+ # dbl2 = 5, so I'm grouping by a constant
+ gtbl <- group_by(tbl, dbl2)
+
+ expect_dplyr_equal(input %>% mutate(!!!list()) %>% collect(), tbl)
+
+ expect_dplyr_equal(input %>% mutate() %>% collect(), gtbl)
+ expect_dplyr_equal(input %>% mutate(!!!list()) %>% collect(), gtbl)
+})
+
+# similar to
https://github.com/tidyverse/dplyr/blob/master/tests/testthat/test-mutate.r#L12-L6
+# THIS WON'T WORK
+# test_that("rownames preserved", {
+# df <- data.frame(x = c(1, 2), row.names = c("a", "b"))
+# expect_dplyr_equal(input %>% mutate(y = 2) %>% collect(), df)
+# })
+
+# similar to
https://github.com/tidyverse/dplyr/blob/master/tests/testthat/test-mutate.r#L18-L29
+test_that("mutations applied progressively", {
Review comment:
In these examples, `expect_dplyr_equal()` is not used correctly.
The second argument should be the _input_, not the expected output.
The `expect_dplyr_equal()` function does not take expected output as one of
its arguments. Instead, it just checks for consistent results when the dplyr
functions are applied to an Arrow `Table`, an Arrow `RecordBatch`, and an R
`data.frame`.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]