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

Implement checks for sequences #21

Open
8 tasks
mwermelinger opened this issue Jan 7, 2024 · 0 comments
Open
8 tasks

Implement checks for sequences #21

mwermelinger opened this issue Jan 7, 2024 · 0 comments
Labels
effort: medium These issues require some work good first issue Good for newcomers priority: high type: feature New feature
Milestone

Comments

@mwermelinger
Copy link
Member

mwermelinger commented Jan 7, 2024

Create a file paddles/preconditions.py that will contain functions that check common preconditions. To start:

  • Move function is_non_decreasing from test_sorting.py to this file and import it in test_sorting.
  • Add 3 functions that check if a sequence is increasing, decreasing or non-increasing.
  • Add a function that checks if all members of a sequence are comparable. Do this like checking for 'non-increasingness' but only stopping if a type error occurs (comparison not implemented).

Create a file tests/test_preconditions.py:

  • Do not import pytest as this file won't use fixtures, only 'static' test data.
  • Define a constant that is a list of strictly increasing sequences.
  • Do the same for decreasing, non-decreasing, non-increasing and comparable sequences.
    • Each constant should include sequences that satisfy only that precondition. For example, NON_DECREASING should not include a sequence like [1,2,3] because that is a strictly increasing sequence.
  • Write a test for is_non_decreasing. II consists of 5 loops, one per constant:
for sequence in INCREASING:
    assert is_non_decreasing(sequence)
for sequence in DECREASING:
    assert not is_non_decreasing(sequence)
...
  • Do similarly for the other 4 functions.

Although this issue requires more effort than some of the others, it's relatively simple and thus a good first issue.

@mwermelinger mwermelinger added effort: low These issues require the least work priority: high type: feature New feature good first issue Good for newcomers effort: medium These issues require some work and removed effort: low These issues require the least work labels Jan 7, 2024
@mwermelinger mwermelinger added this to the Version 0.2 milestone Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: medium These issues require some work good first issue Good for newcomers priority: high type: feature New feature
Projects
None yet
Development

No branches or pull requests

1 participant