xrobin / pROC

Display and analyze ROC curves in R and S+
https://cran.r-project.org/web/packages/pROC/
GNU General Public License v3.0
121 stars 31 forks source link

Uncaught warnings in tests #119

Closed MichaelChirico closed 1 year ago

MichaelChirico commented 1 year ago

https://github.com/xrobin/pROC/blob/edcd42d7f63210e51830e69b5528d968235edf37/tests/testthat/test-roc.R#L338

This line and several similar following have uncaught warnings flagged by testthat:

── Warning ('test-roc.R:338:2'): roc.data.frame reject invalid columns ─────────
This method uses non-standard evaluation (NSE). Did you want to use the `roc_` function instead?
Backtrace:
 1. testthat::expect_error(roc(aSAH, outcomes, s100b), "Column")
      at test-roc.R:338:8
 7. pROC:::roc.data.frame(aSAH, outcomes, s100b)
      at pROC/R/roc.R:21:2
── Warning ('test-roc.R:339:2'): roc.data.frame reject invalid columns ─────────
This method uses non-standard evaluation (NSE). Did you want to use the `roc_` function instead?
Backtrace:
 1. testthat::expect_error(roc(aSAH, "outcomes", "s100b"), "Column")
      at test-roc.R:339:8
 7. pROC:::roc.data.frame(aSAH, "outcomes", "s100b")
      at pROC/R/roc.R:21:2
── Warning ('test-roc.R:342:2'): roc.data.frame reject invalid columns ─────────
This method uses non-standard evaluation (NSE). Did you want to use the `roc_` function instead?
Backtrace:
 1. testthat::expect_error(roc(aSAH, outcome, s100c), "Column")
      at test-roc.R:342:8
 7. pROC:::roc.data.frame(aSAH, outcome, s100c)
      at pROC/R/roc.R:21:2
── Warning ('test-roc.R:343:2'): roc.data.frame reject invalid columns ─────────
This method uses non-standard evaluation (NSE). Did you want to use the `roc_` function instead?
Backtrace:
 1. testthat::expect_error(roc(aSAH, "outcome", "s100c"), "Column")
      at test-roc.R:343:8
 7. pROC:::roc.data.frame(aSAH, "outcome", "s100c")
      at pROC/R/roc.R:21:2

If the warning is intentional, we can nest the expectations:

expect_error(
  expect_warning(
    roc(aSAH, outcomes, s100b),
    "<warning>"
  ),
  "<error>"
)
xrobin commented 1 year ago

This may already have been fixed in d2fba80.