| is_a {testthat} | R Documentation |
Tests whether or not an object inherits from any of a list of classes.
is_a(class) expect_is(object, class, info = NULL, label = NULL)
class |
character vector of class names |
object |
object to test |
info |
extra information to be included in the message (useful when writing tests in loops). |
label |
object label. When |
Other expectations: equals_reference,
expect_equal_to_reference;
equals, expect_equal;
expect-compare,
expect_less_than,
expect_more_than,
is_less_than, is_more_than;
expect_equivalent,
is_equivalent_to;
expect_error, throws_error;
expect_false, expect_true,
is_false, is_true;
expect_identical,
is_identical_to;
expect_match, matches;
expect_message,
shows_message; expect_named,
has_names; expect_null,
is_null; expect_output,
prints_text; expect_warning,
gives_warning;
takes_less_than
expect_is(1, "numeric") a <- matrix(1:10, nrow = 5) expect_is(a, "matrix") expect_is(mtcars, "data.frame") # alternatively for classes that have an is method expect_true(is.data.frame(mtcars))