class-expectations: Class Expectations

Description Usage Arguments Functions See Also Examples

Description

These extend the testthat::expect_is to have finer grain tests.

Usage

1
2
3
4
5
expect_is_not(object, class, label = NULL)

expect_is_exactly(object, class, label = NULL)

expect_all_inherit(object, class, label = NULL)

Arguments

object

the object in question.

class

the expected class object is to be.

label

Used to customise failure messages. For expert use only.

Functions

See Also

Other class: class-tests

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Test to make sure an object is not of a class.
## Not run: 
# will return an error.
expect_is_not(1L, "numeric")

## End(Not run)

# but this is fine.
expect_is_not('a', "numeric")

expect_is_exactly('a', "character")

RDocTaskForce/testextra documentation built on Feb. 5, 2020, 11:05 p.m.