Open
Conversation
Ayantea1
reviewed
Sep 5, 2025
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.
Можно улучшить: общее предусловие для всех тестов можно вынести в фикстуру
Ayantea1
reviewed
Sep 5, 2025
| 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.
Нужно исправить: для get_book_genre должен быть отдельный тест. Тесты не должны дублировать друг друга. В идеале - чтобы в каждом тесте использовался только один проверяемый метод, все остальное можно получить прямым доступом к словарям и спискам
Ayantea1
reviewed
Sep 5, 2025
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.
Нужно исправить: для get_list_of_favorites_books тоже нужен отдельный тест
…get_list_of_favorites_books
Ayantea1
reviewed
Sep 7, 2025
| 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.
Нужно исправить: для get_books_genre тоже нужна отдельная проверка
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.