-
Notifications
You must be signed in to change notification settings - Fork 341
Closed
Labels
Description
During testing, it can be common to make some trial-and-error.
This can lead to this kind of awkward error message.
library(testthat)
x=iris
class(x$Sepal.Length)
#> [1] "numeric"
typeof(x$Sepal.Length)
#> [1] "double"
expss::var_lab(x$Sepal.Length) = "Sepal length"
#lets say I mixed the concepts of classes and types
expect_s3_class(x$Sepal.Length, "double")
#> Error: x$Sepal.Length inherits from `labelled/numeric` not `double`.
expect_s3_class(x$Sepal.Length, "labelled/numeric")
#> Error: x$Sepal.Length inherits from `labelled/numeric` not `labelled/numeric`.Created on 2021-02-07 by the reprex package (v1.0.0)
Maybe this function can either accept this syntax or specifically handle this situation (for instance by throwing a special message when a class contains /).