-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: uncomment test on using embrace operator
- Loading branch information
etiennebacher
committed
Sep 27, 2024
1 parent
bc03d7c
commit 54af305
Showing
7 changed files
with
111 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,48 @@ | ||
# TODO: fix that | ||
# test_that("basic behavior works", { | ||
# test <- pl$DataFrame(x = c(1, 1, 1), y = 4:6, z = c("a", "a", "b")) | ||
# | ||
# add_one <- function(data, add_col) { | ||
# data |> | ||
# mutate(new_col = {{ add_col }} + 1) | ||
# } | ||
# | ||
# add_two <- function(data, add_col) { | ||
# data |> | ||
# mutate("{{add_col}}_plus_2" := {{ add_col }} + 2) | ||
# } | ||
# | ||
# var_summary <- function(data, var) { | ||
# data |> | ||
# summarise(min = min({{ var }}), max = max({{ var }})) | ||
# } | ||
# | ||
# expect_equal( | ||
# test |> | ||
# add_one(x) |> | ||
# pull(new_col), | ||
# rep(2, 3) | ||
# ) | ||
# | ||
# expect_equal( | ||
# test |> | ||
# add_two(x) |> | ||
# pull(x_plus_2), | ||
# rep(3, 3) | ||
# ) | ||
# | ||
# pl_mtcars <- pl$DataFrame(mtcars) | ||
# | ||
# out <- pl_mtcars |> | ||
# group_by(cyl) |> | ||
# var_summary(mpg) | ||
# | ||
# expect_equal( | ||
# out |> arrange(min) |> pull(min), | ||
# c(10.4, 17.8, 21.4) | ||
# ) | ||
# | ||
# expect_equal( | ||
# out |> arrange(max) |> pull(max), | ||
# c(19.2, 21.4, 33.9) | ||
# ) | ||
# }) | ||
test_that("basic behavior works", { | ||
test <- pl$DataFrame(x = c(1, 1, 1), y = 4:6, z = c("a", "a", "b")) | ||
|
||
add_one <- function(data, add_col) { | ||
data |> | ||
mutate(new_col = {{ add_col }} + 1) | ||
} | ||
|
||
add_two <- function(data, add_col) { | ||
data |> | ||
mutate("{{add_col}}_plus_2" := {{ add_col }} + 2) | ||
} | ||
|
||
var_summary <- function(data, var) { | ||
data |> | ||
summarise(min = min({{ var }}), max = max({{ var }})) | ||
} | ||
|
||
expect_equal( | ||
test |> | ||
add_one(x) |> | ||
pull(new_col), | ||
rep(2, 3) | ||
) | ||
|
||
expect_equal( | ||
test |> | ||
add_two(x) |> | ||
pull(x_plus_2), | ||
rep(3, 3) | ||
) | ||
|
||
pl_mtcars <- pl$DataFrame(mtcars) | ||
|
||
out <- pl_mtcars |> | ||
group_by(cyl) |> | ||
var_summary(mpg) | ||
|
||
expect_equal( | ||
out |> arrange(min) |> pull(min), | ||
c(10.4, 17.8, 21.4) | ||
) | ||
|
||
expect_equal( | ||
out |> arrange(max) |> pull(max), | ||
c(19.2, 21.4, 33.9) | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters