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

27 binary to decimal converter #46

Merged
merged 10 commits into from
Jan 8, 2025
Merged

Conversation

Khusro-S
Copy link
Member

@Khusro-S Khusro-S commented Dec 29, 2024


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

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
  • The code includes defensive assertions
  • Defensive assertions include as little logic as possible

@Khusro-S Khusro-S requested a review from Zeinab15 December 29, 2024 18:06
@Khusro-S Khusro-S self-assigned this Dec 29, 2024
@Khusro-S Khusro-S linked an issue Dec 29, 2024 that may be closed by this pull request
Copy link

@Mohamed-Elnageeb Mohamed-Elnageeb left a comment

Choose a reason for hiding this comment

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

nice work Khusro, code implementation is clear , well formated and its strategy is self-explanatory. 👍🤩
A few tiny changes suggested as comments

solutions/binary_to_decimal.py Outdated Show resolved Hide resolved
solutions/binary_to_decimal.py Outdated Show resolved Hide resolved
solutions/tests/test_binary_to_decimal.py Outdated Show resolved Hide resolved
solutions/tests/test_binary_to_decimal.py Outdated Show resolved Hide resolved
@Khusro-S
Copy link
Member Author

Thank you, will make the suggested changes 🙌

@Zeinab15
Copy link

Hello @Khusro-S ,
I reviewed it, everything is good just update it as Mohamed mentioned.
All the best for you.

@Khusro-S
Copy link
Member Author

Khusro-S commented Jan 1, 2025

Thank you both @Mohamed-Elnageeb and @Zeinab15. I made all the suggested changes and corrections 🙌 .
Kindly review the changes one last time to make sure I didnt miss anything this time 😅

Zeinab15
Zeinab15 previously approved these changes Jan 2, 2025
Copy link

@Zeinab15 Zeinab15 left a comment

Choose a reason for hiding this comment

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

Well done @Khusro-S, I approve

Copy link

@Mohamed-Elnageeb Mohamed-Elnageeb left a comment

Choose a reason for hiding this comment

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

perfectly done!

… function.

- Replaced assert statements with specific error handling (TypeError and ValueError).
- Updated test cases to check for the new errors:
-- TypeError for non-integer inputs (string, None, float).
-- ValueError for negative year inputs.
@Khusro-S Khusro-S dismissed stale reviews from Mohamed-Elnageeb and Zeinab15 via 718d468 January 5, 2025 13:26
Copy link

@Mohamed-Elnageeb Mohamed-Elnageeb left a comment

Choose a reason for hiding this comment

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

Well done

@Khusro-S Khusro-S merged commit 581a7a2 into main Jan 8, 2025
10 checks passed
@Khusro-S Khusro-S deleted the 27-binary_to_decimal_converter branch January 8, 2025 09:05
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.

Binary_to_Decimal_Converter
3 participants