Skip to content

sprint-2#8

Open
ShamilovR wants to merge 1 commit intomasterfrom
sprint-2
Open

sprint-2#8
ShamilovR wants to merge 1 commit intomasterfrom
sprint-2

Conversation

@ShamilovR
Copy link
Copy Markdown
Owner

No description provided.

super().__init__(test_case_id, name, step_description, expected_result)

def print_test_case_info(self):
print(f"ID тест-кейса: {self.test_case_id}"
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Нужно исправить: первые четыре параметра уже умеет печатать родительский класс в методе print_test_case_info. Вызвать его можно через функцию super().

class Comedy(Movies):

def add_movie(self, movie):
sself.movies.append(movie)
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Нужно исправить: опечатка в слове self

Copy link
Copy Markdown
Owner Author

@ShamilovR ShamilovR Jan 12, 2025

Choose a reason for hiding this comment

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

Нужно исправить: здесь и далее: добавление фильма в конец списка уже реализовано в родительском классе. Чтобы не дублировать код можно вызвать метод add_movie у класса родителя через super().

sself.movies.append(movie)
return f'Комедии: {self.movies}'

class Drama():
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Нужно исправить: не реализовано наследование

elif place < 1:
print('Спортсмен не может занять нулевое или отрицательное место')
else:
points = 100 - place
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Нужно исправить: неверная формула расчета баллов


@staticmethod
def get_total_points(meters, place):
total = PointsForPlace.get_points_for_place(place) + PointsForMeters.get_points_for_meters(meters)
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Нужно исправить: класс TotalPoints наследует методы get_points_for_place и get_points_for_meters. Обращение через будет более целесообразным. Иначе наследование не имеет смысла.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Тут стоило указать варианты обращения через self или super

self.hours = hours
self.rest_days = rest_days
self.email = email
self.hourly_payment = 400
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Нужно исправить: атрибут hourly_payment относится к экземпляру класса, а должен к классу.

email = f'{name}@email.com'
return cls(name, hours, rest_days, email)

def set_hourly_payment(self):
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Нужно исправить: set_hourly_payment должен быть классовым методом. Иначе изменение будет происходить в рамках конкретного экземпляра класса, а не класса в целом.

self.hourly_payment = 500

def salary(self, hours):
return hours * EmployeeSalary.hourly_payment
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Нужно исправить: для расчета не нужно передавать методу количество часов. Метод должен брать их от экземпляра класса.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Можно лучше: доступ к атрибуту hourly_payment можно получить через экземпляр класса.

self.draws = draws
self.losses = losses

class Football():
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Нужно исправить: не реализовано наследование от Results

return f'Общее количество очков: {3 * self.victories + self.draws}'


class Hockey():
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Нужно исправить: не реализовано наследование от Results

return f'Хоккейных поражений: {self.losses}'

def total_points(self):
return f'Общее количество очков: {3 * self.victories + self.draws}'
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Нужно исправить: неверная формула расчета очков

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.

2 participants