Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Dec 29, 2024
1 parent be50727 commit 865bd55
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ S3method(as.data.frame,performance_score)
S3method(as.data.frame,r2_bayes)
S3method(as.data.frame,r2_loo)
S3method(as.data.frame,r2_nakagawa)
S3method(as.double,check_outliers)
S3method(as.double,performance_roc)
S3method(as.numeric,check_outliers)
S3method(check_autocorrelation,default)
S3method(check_collinearity,BFBayesFactor)
S3method(check_collinearity,MixMod)
Expand Down
2 changes: 1 addition & 1 deletion R/check_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ as.data.frame.check_outliers <- function(x, ...) {
}

#' @export
as.numeric.check_outliers <- function(x, ...) {
as.double.check_outliers <- function(x, ...) {
attributes(x)$data$Outlier
}

Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-check_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -406,3 +406,10 @@ test_that("check_outliers with DHARMa", {
)
)
})


test_that("check_outliers with DHARMa", {
data(mtcars)
out <- check_outliers(mtcars$mpg, method = "zscore", threshold = 2)
expect_equal(which(as.numeric(out) == 1), c(18, 20))

Check warning on line 414 in tests/testthat/test-check_outliers.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=tests/testthat/test-check_outliers.R,line=414,col=3,[expect_identical_linter] Use expect_identical(x, y) by default; resort to expect_equal() only when needed, e.g. when setting ignore_attr= or tolerance=.
})

0 comments on commit 865bd55

Please sign in to comment.