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

expect_setequal() should make more of an effort to display actual values #1657

Closed
hadley opened this issue Jul 12, 2022 · 1 comment · Fixed by #1745
Closed

expect_setequal() should make more of an effort to display actual values #1657

hadley opened this issue Jul 12, 2022 · 1 comment · Fixed by #1745
Labels
expectation 🙀 feature a feature request or enhancement

Comments

@hadley
Copy link
Member

hadley commented Jul 12, 2022

No description provided.

@hadley hadley added feature a feature request or enhancement expectation 🙀 labels Sep 19, 2022
@hadley hadley changed the title test_setequal() should make more of an effort to display actual values expect_setequal() should make more of an effort to display actual values Sep 19, 2022
@MichaelChirico
Copy link
Contributor

+1! I just rewrote a few tests from

expect_setequal(DF$col, c(...))

to

expect_identical(sort(unique(DF$col)), c(...))

The expect_setequal() version is much more readable but the failure mode for expect_identical() is much more actionable (at least in 3e)

DF = data.frame(a = 1:3)
expect_setequal(DF$a, 2:4)
# Error: DF$a[1] absent from 2:4
expect_identical(sort(unique(DF$a)), 2:4)
# Error: sort(unique(DF$a)) (`actual`) not identical to 2:4 (`expected`).

#   `actual`: 1 2 3
# `expected`: 2 3 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
expectation 🙀 feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants