Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR corrects the behavior and examples of the right-to-left maxima / left-to-right minima layer decomposition by updating test expectations, adjusting docstring examples, and changing the implementation to standardize the remainder after each layer.
- Updated test assertions for
count_rtlmax_ltrmin_layersfrom 4 to 3 for specific permutations. - Revised docstring examples in
count_rtlmax_ltrmin_layersandrtlmax_ltrmin_decompositionto match the corrected logic. - Changed the decomposition implementation to use
Perm.to_standard(...)when constructing the next-layer permutation.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/patterns/test_perm.py | Adjusted expected values in assertions for count_rtlmax_ltrmin_layers and decomposition tests. |
| permuta/patterns/perm.py | Updated docstring examples for both methods; switched to Perm.to_standard in the decomposition loop. |
Comments suppressed due to low confidence (3)
tests/patterns/test_perm.py:1966
- [nitpick] Consider refactoring the block of repetitive
assert ... == expectedlines forcount_rtlmax_ltrmin_layers()into a pytest@pytest.mark.parametrizetest to reduce duplication and improve readability.
assert Perm((2, 1, 3, 0)).count_rtlmax_ltrmin_layers() == 1
tests/patterns/test_perm.py:2004
- [nitpick] Similarly, you could parameterize the decomposition cases in
test_rtlmax_ltrmin_decompositionusing@pytest.mark.parametrizeto make the test suite more concise and easier to extend.
assert list(Perm((2, 3, 0, 4, 1, 5)).rtlmax_ltrmin_decomposition()) == [
permuta/patterns/perm.py:2479
- [nitpick] Passing a generator directly to
Perm.to_standardis valid, but wrapping it in a list comprehension (e.g.,Perm.to_standard([perm[i] for i in ...])) can improve readability by making all elements explicit.
perm = Perm.to_standard(
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.
No description provided.