File: test-translate-sql-quantile.R

package info (click to toggle)
r-cran-dbplyr 2.3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,376 kB
  • sloc: sh: 13; makefile: 2
file content (11 lines) | stat: -rw-r--r-- 520 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
test_that("quantile and median don't change without warning", {
  expect_snapshot(translate_sql(quantile(x, 0.75, na.rm = TRUE), window = FALSE))
  expect_snapshot(translate_sql(quantile(x, 0.75, na.rm = TRUE), vars_group = "g"))
  expect_snapshot(translate_sql(median(x, na.rm = TRUE), window = FALSE))
  expect_snapshot(translate_sql(median(x, na.rm = TRUE), vars_group = "g"))
})

test_that("checks for invalid probs", {
  expect_error(check_probs("a"), "numeric")
  expect_error(check_probs(1:3), "single value")
})