Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: expect_inherits() #2016

Closed
t-kalinowski opened this issue Nov 6, 2024 · 1 comment · Fixed by #2017
Closed

FR: expect_inherits() #2016

t-kalinowski opened this issue Nov 6, 2024 · 1 comment · Fixed by #2017
Milestone

Comments

@t-kalinowski
Copy link
Member

Now that base::inherits() can accept any object in the what argument, and S7 encourages using reified class objects instead of class names as character vectors, it might be useful to add an expect_inherits() function. This function would generally behave like expect_s3_class() but could dispatch nameOfClass() on the second argument when needed.

For example, it could replace tests like those seen here: cole-brokamp/fr#15

Possibly related issue: #1448

@hadley
Copy link
Member

hadley commented Nov 6, 2024

I feel like a more tactical change would be to implement expect_s7_class() because it has no implications for existing expect_s3_class() usage. It makes it more clear what the expectation does, and allows argument checking to be more precise.

@hadley hadley added this to the v3.3.0 milestone Nov 6, 2024
hadley added a commit that referenced this issue Nov 6, 2024
@hadley hadley closed this as completed in fc0025c Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants