r-lib / testthat

An R 📦 to make testing 😀
https://testthat.r-lib.org
Other
891 stars 317 forks source link

docs: `expect_s4_class()` cannot accept a vector of classes #1989

Open maelle opened 1 month ago

maelle commented 1 month ago

The manual page for expect_s4_class() and expect_s3_class() states that the class argument can be

a character vector of class names

However it is not true for expect_s4_class() that uses

https://github.com/r-lib/testthat/blob/fe38519d72247a8907228a4ecaf926483aa5d4ff/R/expect-inheritance.R#L112C9-L112C20

where methods::is() only accepts one class.

I suspect using more than one class in expect_s4_class() might not make any sense :sweat_smile: but maybe the documentation of the parameter could be rephrased slightly?