Repository navigation
Minor refactor to cleanup/improve matching test suite - #8068
Merged
Merged
Conversation
Removes layer of indirection that is not necessary because edges_equal already handles arbitrary edge ordering.
Peiffap
approved these changes
May 26, 2025
Peiffap
left a comment
Member
There was a problem hiding this comment.
This is great. Much more readable this way :).
Just a small typo!
dschult
approved these changes
May 26, 2025
dschult
left a comment
Member
There was a problem hiding this comment.
Nice -- This is much more readable. :)
Co-authored-by: Gilles Peiffer <[email protected]>
amcandio
pushed a commit
to amcandio/networkx
that referenced
this pull request
Jul 20, 2025
* Factor out matching_dict_to_set for expected. Removes layer of indirection that is not necessary because edges_equal already handles arbitrary edge ordering. * pytest.raises fn -> context w/ error msg checking. * Factor out invalid input tests for is_\*matching fns. * Consolidate not-implemented-for tests. * Update networkx/algorithms/tests/test_matching.py Co-authored-by: Gilles Peiffer <[email protected]> --------- Co-authored-by: Gilles Peiffer <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A few test suite improvements from having read the code while reviewing #8062.
This PR essentially contains 3 unrelated proposals, and might be easier to digest commit-by-commit:
matching_dict_to_setfor munging the "expected" answers. IMO it's much more straightforward to compare to the expected edge sets explicitly. This is possible becausenx.utils.edges_equalalready handles arbitrary edge ordering, so there's no need to do so twice.pytest.raisesfrom function calls to the context manager pattern, and adds thematch=kwarg better ensure that the expected exception is being raised.is_*matchingfunctions have the same exception message for the input validation exceptions. By lumping them altogether in the test suite, it makes it less likely that individual function messages will diverge in the future.