|
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 The different |
| 23 | +#' @param class The required type varies depending on the function: |
24 | 24 | #' * `expect_type()`: a string. |
25 | | -#' * `expect_s3_class()`: a character vector of class names. If you provide |
26 | | -#' multiple class names, the test will pass if `object` inherits from any |
27 | | -#' of them, unless `exact = TRUE`. |
28 | | -#' * `expect_s4_class()`: a string or `NA` to assert that `object` is not an |
29 | | -#' S4 object. |
| 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. |
30 | 29 | #' * `expect_r6_class()`: a string. |
31 | 30 | #' * `expect_s7_class()`: an [S7::S7_class()] object. |
32 | 31 | #' |
33 | | -#' For historical reasons, `expect_s3_class()` and `expect_s4_class()` take |
34 | | -#' `NA` to assert that the `object` is not an S3 or S4 object. |
| 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. |
35 | 34 | #' @inheritParams expect_that |
36 | 35 | #' @family expectations |
37 | 36 | #' @examples |
@@ -87,7 +86,7 @@ expect_type <- function(object, type) { |
87 | 86 | #' @rdname inheritance-expectations |
88 | 87 | #' @param exact If `FALSE`, the default, checks that `object` inherits |
89 | 88 | #' from any element of `class`. If `TRUE`, checks that object has a class |
90 | | -#' that's identical to `class`. |
| 89 | +#' that exactly matches `class`. |
91 | 90 | expect_s3_class <- function(object, class, exact = FALSE) { |
92 | 91 | check_bool(exact) |
93 | 92 |
|
|
0 commit comments