-
Notifications
You must be signed in to change notification settings - Fork 21
Sprint_4 #16
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
base: main
Are you sure you want to change the base?
Sprint_4 #16
Conversation
tests.py
Outdated
|
|
||
| @pytest.mark.parametrize("name", ["", "A" * 41]) | ||
| def test_add_new_book_invalid_name(self, name): | ||
| collector = BooksCollector() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно улучшить: общее предусловие для всех тестов можно вынести в фикстуру
| collector = BooksCollector() | ||
| collector.add_new_book("Вокруг света за 80 дней") | ||
| collector.set_book_genre("Вокруг света за 80 дней", "Приключения") | ||
| assert collector.get_book_genre("Вокруг света за 80 дней") == "Приключения" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно исправить: для get_book_genre должен быть отдельный тест. Тесты не должны дублировать друг друга. В идеале - чтобы в каждом тесте использовался только один проверяемый метод, все остальное можно получить прямым доступом к словарям и спискам
tests.py
Outdated
| collector = BooksCollector() | ||
| collector.add_new_book("Вокруг света за 80 дней") | ||
| collector.add_book_in_favorites("Вокруг света за 80 дней") | ||
| assert "Вокруг света за 80 дней" in collector.get_list_of_favorites_books() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно исправить: для get_list_of_favorites_books тоже нужен отдельный тест
…get_list_of_favorites_books
| collector.add_new_book("Вокруг света за 80 дней") | ||
| collector.set_book_genre("Вокруг света за 80 дней", "Приключения") | ||
| # проверяем напрямую словарь, а не через get_book_genre | ||
| assert collector.get_books_genre()["Вокруг света за 80 дней"] == "Приключения" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно исправить: для get_books_genre тоже нужна отдельная проверка
No description provided.