Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

expect_is

Does an object inherit from a given class?


Description

[Superseded]

expect_is() is an older form that uses inherits() without checking whether x is S3, S4, or neither. Instead, I'd recommend using expect_type(), expect_s3_class() or expect_s4_class() to more clearly convey your intent.

Usage

expect_is(object, class, info = NULL, label = NULL)

Arguments

object

Object to test.

Supports limited unquoting to make it easier to generate readable failures within a function or for loop. See quasi_label for more details.

class

Either a character vector of class names, or for expect_s3_class() and expect_s4_class(), an NA to assert that object isn't an S3 or S4 object.

3rd edition

[Deprecated]

expect_is() is formally deprecated in the 3rd edition.


testthat

Unit Testing for R

v3.0.2
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre], RStudio [cph, fnd], R Core team [ctb] (Implementation of utils::recover())
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.