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

Challenge 39 #46

Closed
wants to merge 2 commits into from
Closed

Challenge 39 #46

wants to merge 2 commits into from

Conversation

Mr-Glucose
Copy link

@Mr-Glucose Mr-Glucose commented Jan 7, 2025

Pull Request Template for Challenge 39


Name: Solution Review
About: A template PR for code review with a checklist.


Description

This PR implements Challenge 39: Word Length Counter:

  • A Python module (word_length_counter.py) to calculate the lengths of words in a sentence, ignoring punctuation, and returning a list of word lengths.
  • Includes a comprehensive test suite (tests/test_word_length_counter.py) to validate the functionality.

Checklist

Behavior

  • Files:
    • The file name (word_length_counter.py) accurately describes the function's behavior.
    • The module has a descriptive docstring.
    • The test file (tests/test_word_length_counter.py) name matches the function file.
    • The test file includes a descriptive docstring.

Unit Tests

  • The test class is named meaningfully and uses PascalCase (TestWordLengths).
  • The test class includes a descriptive docstring.
  • Each unit test:
    • Has a meaningful name.
    • Contains a clear docstring.
    • Includes only one assertion per test.
    • Avoids logic within the test.
  • All tests pass successfully.
  • Defensive assertions and boundary cases are tested.

Function Docstring

  • Function behavior is documented.
  • Function arguments are described:
    • Type: str.
    • Purpose: To compute word lengths from the input sentence.
    • Assumptions: Input string is well-formed text.
  • Return value is described:
    • Type: list[int].
    • Assumptions: List contains lengths of words (no punctuation).
  • Defensive assertions are unnecessary in this case.
  • Three passing doctests are included.

The Function

  • Function name (word_lengths) describes its behavior.
  • Function name matches the file name.
  • Correct type annotations are included.
  • Function is not called within its own file.

Strategy

  • Variable names enhance readability.
  • Comments describe the strategy effectively.
  • Code lines are spaced to show logical stages of the process.

Implementation

  • Code passes formatting checks.
  • Code passes all Ruff linting checks.
  • Pylint errors are addressed where applicable.
  • Variables use snake_case and are clear in their purpose.
  • Code implementation aligns with the chosen strategy.
  • Implementation is as simple as possible.
  • No commented-out code is left in the implementation.
  • No print statements are used.

@likechrisss likechrisss requested review from likechrisss and removed request for likechrisss January 9, 2025 13:10
@Mr-Glucose Mr-Glucose closed this Jan 9, 2025
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