Skip to content

Solution py-distance-class#2792

Open
TrickyTenshi wants to merge 4 commits into
mate-academy:masterfrom
TrickyTenshi:develop
Open

Solution py-distance-class#2792
TrickyTenshi wants to merge 4 commits into
mate-academy:masterfrom
TrickyTenshi:develop

Conversation

@TrickyTenshi

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

I'm requesting changes because the implementation has critical failures that are blocking task completion.

Critical issues that must be fixed:

  1. Missing period in __str__ (5 test failures): Your __str__ method returns "Distance: 50 kilometers\n" but the required format is "Distance: 50 kilometers." with a trailing period. Add a period after "kilometers" in the return statement.

  2. __mul__ incorrectly accepts Distance argument: The type annotation includes Distance but the checklist explicitly states __mul__ should only accept int | float. You need to remove Distance from the type annotation and remove any code that handles Distance instances (it should raise TypeError for Distance operands).

  3. __truediv__ incorrectly accepts Distance argument: Same issue as __mul__ - the type annotation includes Distance but the checklist forbids it. Remove Distance handling from the implementation.

  4. Unnecessary else statements [CHECKLIST ITEM #1]: Every method follows if ... return ... else: ... which is redundant. Remove all else blocks after return statements since the function already exits. For example:

    def __add__(self, other):
        if isinstance(other, Distance):
            return Distance(self.km + other.km)
        return Distance(self.km + other)  # No else needed

The test failures confirm these are functional blockers. Fix the __str__ period issue first since it affects the most tests.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread app/main.py Outdated
Comment thread app/main.py Outdated
Comment thread app/main.py Outdated
Comment thread app/main.py Outdated
Comment thread app/main.py Outdated
Comment thread app/main.py Outdated
Comment thread app/main.py Outdated
Comment thread app/main.py Outdated
Comment thread app/main.py Outdated
Comment thread app/main.py Outdated

@Losiev Losiev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Well done!👏

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.

3 participants