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

Solution #350

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Solution #350

wants to merge 2 commits into from

Conversation

Marinel444
Copy link

No description provided.

Comment on lines +17 to +18
if self.min_amount <= value <= self.max_amount:
setattr(obj, self.protected_name, value)

Choose a reason for hiding this comment

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

raise ValueError when get incorrect value and add descriptive error message

app/main.py Outdated
Comment on lines 41 to 44
def validate(self) -> bool:
return (4 <= self.age <= 14
and 80 <= self.height <= 120
and 20 <= self.weight <= 50)

Choose a reason for hiding this comment

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

you should make validation by using IntegerRange

app/main.py Outdated
Comment on lines 48 to 51
def validate(self) -> bool:
return (14 <= self.age <= 60
and 120 <= self.height <= 220
and 50 <= self.weight <= 120)

Choose a reason for hiding this comment

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

same here

Copy link

@Dimosphen1 Dimosphen1 left a comment

Choose a reason for hiding this comment

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

LGTM, well done! One comment is left for consideration. Besides that, consider placing arguments on a new line in case they have type annotations, it could improve the readability later on.

Comment on lines +64 to +68
if self.limitation_class(
age=visitor.age,
height=visitor.height,
weight=visitor.weight
):

Choose a reason for hiding this comment

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

There is no need to create an if condition, you could just make an initialization of a limitation_class.

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