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

Check_Number_Type #42

Merged
merged 11 commits into from
Jan 11, 2025
Merged

Check_Number_Type #42

merged 11 commits into from
Jan 11, 2025

Conversation

Emanfalouji
Copy link

@Emanfalouji Emanfalouji commented Jan 6, 2025


name: solution review
about: A template PR for code review with a checklist

Behavior

Files

  • The file name describes the function's behavior
  • There is a module docstring in the function file
  • The test file's name matches the function file name -
    /tests/test_file_name.py
  • There is a module docstring in the tests file

Unit Tests

  • The test class has a helpful name in PascalCase
  • The test class has a docstring
  • Every unit test has
    • A helpful name
    • A clear docstring
    • Only one assertion
    • There is no logic in the unit test
  • All tests pass
  • There are tests for defensive assertions
  • There are tests for boundary cases

Function Docstring

  • The function's behavior is described
  • The function's arguments are described:
    • Type
    • Purpose
    • Other assumptions (eg. if it's a number, what's the expected range?)
  • The return value is described
    • Type
    • Other assumptions are documented
  • The defensive assertions are documented using Raises:
    • Each assumption about an argument is checked with an assertion
    • Each assertion checks for only one assumption about the argument
  • Include 3 or more (passing!) doctests

The Function

  • The function's name describes it's behavior
  • The function's name matches the file name
  • The function has correct type annotations
  • The function is not called in the function file

Strategy

Do's

  • Variable names help to understand the strategy
  • Any comments are clear and describe the strategy
  • Lines of code are spaced to help show different stages of the strategy

Don'ts

  • The function's strategy is not described in the documentation
  • Comments explain the strategy, not the implementation
  • The function does not have more comments than code
    • If it does, consider finding a new strategy or a simpler implementation

Implementation

  • The code passes the formatting checks
  • The code passes all Ruff linting checks
  • The code has no (reasonable) Pylint errors
    • In code review, you can decide when fixing a Pylint error is helpful and
      when it's too restricting.
  • Variables are named with snake_case
  • Variable names are clear and helpful
  • The code follows the strategy as simply as possible
  • The implementation is as simple as possible given the strategy
  • There are no commented lines of code
  • There are no print statements anywhere
  • The code includes defensive assertions
  • Defensive assertions include as little logic as possible

@Emanfalouji Emanfalouji linked an issue Jan 6, 2025 that may be closed by this pull request
@Emanfalouji Emanfalouji self-assigned this Jan 6, 2025
@Derekkarungani Derekkarungani self-requested a review January 6, 2025 22:11
@Frank2446-dotcom Frank2446-dotcom self-requested a review January 8, 2025 05:42
Frank2446-dotcom

This comment was marked as outdated.

@Frank2446-dotcom Frank2446-dotcom self-requested a review January 8, 2025 07:00
@Emanfalouji
Copy link
Author

Hi
Could you review the code using the checklist please

@Derekkarungani Derekkarungani removed their request for review January 11, 2025 09:55
@AzzaOmer1 AzzaOmer1 requested review from AzzaOmer1 and removed request for Frank2446-dotcom January 11, 2025 10:29
Returns:
results will be a text whether "The number is even", "The number is odd"
or "Enter a valid number "
Examples :

Choose a reason for hiding this comment

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

The docstring includes only two doctests passing , Includes 3 or more passing doctests


Parameters:
user_input (str): str
Raises:

Choose a reason for hiding this comment

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

Each assertion checks for only one assumption about the argument, each argument have one like,
ValueError: .....
ValueError: .....

@AzzaOmer1 AzzaOmer1 self-requested a review January 11, 2025 17:14
@Emanfalouji
Copy link
Author

Thank you for your insightful commits @AzzaOmer1
Please take a look at the edits



Parameters:
user_input (str): str

Choose a reason for hiding this comment

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

explain more for input parameter

@AzzaOmer1 AzzaOmer1 self-requested a review January 11, 2025 19:16
"The number is odd"
>>> check_number_type("-11")
"The number is odd"
>>> check_number_type("")

Choose a reason for hiding this comment

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

Detail input assumptions and expand the Raises section to document defensive assertions thoroughly.

"The number is odd"
>>> check_number_type("")
"Input cannot be empty. Enter a valid number."
>>> check_number_type("Eman")

Choose a reason for hiding this comment

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

Detail input assumptions and expand the Raises section to document defensive assertions thoroughly.

@AzzaOmer1 AzzaOmer1 self-requested a review January 11, 2025 19:47
@AzzaOmer1
Copy link

done all reviews

@AzzaOmer1 AzzaOmer1 merged commit 90d3248 into main Jan 11, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Challenge_check_numbers_even_odd
3 participants