Skip to content

bugfix!#201

Merged
jaypantone merged 3 commits intodevelopfrom
fix-rtlmin-ltrmax-decom
Jun 20, 2025
Merged

bugfix!#201
jaypantone merged 3 commits intodevelopfrom
fix-rtlmin-ltrmax-decom

Conversation

@jaypantone
Copy link
Collaborator

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_layers from 4 to 3 for specific permutations.
  • Revised docstring examples in count_rtlmax_ltrmin_layers and rtlmax_ltrmin_decomposition to 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 ... == expected lines for count_rtlmax_ltrmin_layers() into a pytest @pytest.mark.parametrize test 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_decomposition using @pytest.mark.parametrize to 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_standard is 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(

@jaypantone jaypantone merged commit 5467d3a into develop Jun 20, 2025
24 checks passed
@jaypantone jaypantone deleted the fix-rtlmin-ltrmax-decom branch June 20, 2025 19:03
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 this pull request may close these issues.

1 participant