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

Canonicalize by sorting keys instead of values #4455

Open
m-vo opened this issue Sep 12, 2020 · 0 comments
Open

Canonicalize by sorting keys instead of values #4455

m-vo opened this issue Sep 12, 2020 · 0 comments
Labels
feature/assertion Issues related to assertions and expectations type/enhancement A new idea that should be implemented

Comments

@m-vo
Copy link

m-vo commented Sep 12, 2020

Using assertEqualsCanonicalizing effectively uses sort() to canonicalize arrays. I fail to see where this might become helpful in a unit test scenario (unidentifiable values whose order doesn't matter)? On the other hand (unordered) key/value collections (i.e. arrays with non-integer keys) are a common thing which would need to be canonicalized with ksort() instead and currently are cumbersome to compare against each other.

Maybe I'm missing on the design decision behind that. 🙂
Or in other words: What about supporting the latter case out of the box as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/assertion Issues related to assertions and expectations type/enhancement A new idea that should be implemented
Projects
None yet
Development

No branches or pull requests

2 participants