Skip to content

Commit

Permalink
Remove tests depending on randomness
Browse files Browse the repository at this point in the history
  • Loading branch information
sgvignali committed Dec 16, 2024
1 parent c4ee28b commit 8d00231
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 57 deletions.
21 changes: 0 additions & 21 deletions tests/testthat/_snaps/thinData.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
# The function writes messages

Code
c <- thinData(rbind(x, x), env = predictors, progress = FALSE)
Message
v Removed no NAs and 9000 duplicated locations

---

Code
c <- thinData(x, env = predictors, progress = FALSE)
Message
v Removed -6507 NAs and no duplicated locations

---

Code
c <- thinData(rbind(x, x), env = predictors, progress = FALSE)
Message
v Removed -12950 NAs and 2525 duplicated locations

# The function raises errors

! Column "A" does not exist
Expand Down
36 changes: 0 additions & 36 deletions tests/testthat/test-thinData.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,42 +46,6 @@ test_that("The function works with custom dataframe", {
expect_equal(colnames(c), colnames(df))
})

test_that("The function writes messages", {
# Only duplicates
x <- terra::spatSample(predictors,
size = 9000,
method = "random",
na.rm = TRUE,
xy = TRUE,
values = FALSE)

expect_snapshot(c <- thinData(rbind(x, x),
env = predictors,
progress = FALSE))

# Only NAs
x <- terra::spatSample(predictors,
size = 9000,
method = "random",
xy = TRUE,
values = FALSE)

expect_snapshot(c <- thinData(x,
env = predictors,
progress = FALSE))

# Both, duplicates and NAs
x <- terra::spatSample(predictors,
size = 9000,
method = "random",
xy = TRUE,
values = FALSE)

expect_snapshot(c <- thinData(rbind(x, x),
env = predictors,
progress = FALSE))
})

test_that("The function raises errors", {
expect_snapshot_error(thinData(x,
env = predictors,
Expand Down

0 comments on commit 8d00231

Please sign in to comment.