# NOT RUN {
# has_attributes is vectorized on attrs
has_attributes(sleep, c("class", "names", "row.names", "col.names"))
# You can check for any or all of these attributes to be present.
x <- structure(c(a = 1), b = 2)
assert_has_all_attributes(x, c("names", "b"))
assert_has_any_attributes(x, c("names", "not an attribute"))
# These examples should fail.
assertive.base::dont_stop({
assert_has_all_attributes(x, c("names", "not an attribute"))
})
# }
Run the code above in your browser using DataLab