Skip to content

Commit

Permalink
more pipe fixes -- forgot to search tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ehwenk committed Nov 13, 2024
1 parent 871fac8 commit ad6bea3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion tests/testthat/test-extract_.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ genus = "Eucalyptus"
taxon_name = "Banskia serrata"

test_that("Error message is triggered", {
expect_error(austraits_5.0.0_lite |> extract_taxa())
expect_error(austraits_5.0.0_lite %>% extract_taxa())
})

test_extract_error <- function(austraits){
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-misc_bugs_.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ test_that("Dataframe is extracted correctly", {
dplyr::filter(trait_name == "lifespan")

# Extract trait after
veronica |> extract_trait("lifespan") -> genus_first
veronica %>% extract_trait("lifespan") -> genus_first

# Extract trait first
austraits |> extract_trait("lifespan") -> lifespan
austraits %>% extract_trait("lifespan") -> lifespan

# Extract taxa after
lifespan |> extract_taxa(genus = "Veronica") -> trait_first
lifespan %>% extract_taxa(genus = "Veronica") -> trait_first

expect_setequal(trait_first$traits$value, veronica_lifespan$value)
expect_setequal(trait_first$traits$value, genus_first$traits$value)
Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/test-plot_.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ test_that("Function doesn't throw error", {

test_non_compatibile <- function(austraits){
test_that("Throws correct errors for deprecated or non-compatible",{
expect_error(austraits |>
extract_dataset("Falster_2003") |>
purrr::pluck("traits") |> plot_locations()
expect_error(austraits %>%
extract_dataset("Falster_2003") %>%
purrr::pluck("traits") %>% plot_locations()
)

expect_error(austraits |>
extract_dataset("Falster_2003") |>
purrr::pluck("traits") |> plot_lplot_site_locationsocations()
expect_error(austraits %>%
extract_dataset("Falster_2003") %>%
purrr::pluck("traits") %>% plot_lplot_site_locationsocations()
)
})
}
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-trait_pivot_.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test_pivot_success <- function(austraits){
test_that("pivot on subset of data", {

expect_silent(
wide_data <- austraits |> trait_pivot_wider()
wide_data <- austraits %>% trait_pivot_wider()
)

expect_type(wide_data, "list")
Expand All @@ -19,7 +19,7 @@ purrr::walk(inputs,


test_that("Widen structure is expected", {
wide_data <- austraits_5.0.0_lite |> trait_pivot_wider()
wide_data <- austraits_5.0.0_lite %>% trait_pivot_wider()
names(wide_data)
#Checking if widened data has the same length as variables that we are spreading
expect_gt(ncol(wide_data), ncol(austraits_5.0.0_lite$traits))
Expand Down

0 comments on commit ad6bea3

Please sign in to comment.