|
20 | 20 | #' See [expect_vector()] for testing properties of objects created by vctrs. |
21 | 21 | #' |
22 | 22 | #' @param type String giving base type (as returned by [typeof()]). |
23 | | -#' @param class |
24 | | -#' * `expect_type()`: a single string giving an R base type. |
25 | | -#' * `expect_s3_class()`: a character vector of class names or `NA` to assert |
26 | | -#' that `object` isn't an S3 object. If you provide multiple class names, |
27 | | -#' the test will pass if `object` inherits from any of them, unless |
28 | | -#' `exact = TRUE`. |
29 | | -#' * `expect_s4_class()`: a character vector of class names or `NA` to assert |
30 | | -#' that `object` isn't an S4 object. |
31 | | -#' * `expect_r6_class()`: a string. |
32 | | -#' * `expect_s7_class()`: an [S7::S7_class()] object. |
| 23 | +#' @param class The required type varies depending on the function: |
| 24 | +#' * `expect_type()`: a string. |
| 25 | +#' * `expect_s3_class()`: a string or character vector. The behaviour of |
| 26 | +#' multiple values (i.e. a character vector) is controlled by the |
| 27 | +#' `exact` argument. |
| 28 | +#' * `expect_s4_class()`: a string. |
| 29 | +#' * `expect_r6_class()`: a string. |
| 30 | +#' * `expect_s7_class()`: an [S7::S7_class()] object. |
| 31 | +#' |
| 32 | +#' For historical reasons, `expect_s3_class()` and `expect_s4_class()` also |
| 33 | +#' take `NA` to assert that the `object` is not an S3 or S4 object. |
33 | 34 | #' @inheritParams expect_that |
34 | 35 | #' @family expectations |
35 | 36 | #' @examples |
@@ -85,7 +86,7 @@ expect_type <- function(object, type) { |
85 | 86 | #' @rdname inheritance-expectations |
86 | 87 | #' @param exact If `FALSE`, the default, checks that `object` inherits |
87 | 88 | #' from any element of `class`. If `TRUE`, checks that object has a class |
88 | | -#' that's identical to `class`. |
| 89 | +#' that exactly matches `class`. |
89 | 90 | expect_s3_class <- function(object, class, exact = FALSE) { |
90 | 91 | check_bool(exact) |
91 | 92 |
|
|
0 commit comments