-
Notifications
You must be signed in to change notification settings - Fork 0
BooksCollector и тесты #5
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?
Conversation
| from books_collector import BooksCollector | ||
|
|
||
|
|
||
| @pytest.fixture |
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.
Можно улучшить: фикстуры стоит хранить в отдельном модуле
test_books_collector.py
Outdated
| collector.add_new_book("Книга") | ||
| collector.set_book_genre("Книга", genre) | ||
| expected = genre if should_set else "" | ||
| assert collector.get_book_genre("Книга") == expected |
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 должен быть отдельный тест. Тесты не должны дублировать друг друга. В идеале - чтобы в каждом тесте использовался только один проверяемый метод, все остальное можно получить прямым доступом к словарям и спискам
| collector.add_new_book("Гарри Поттер") | ||
| collector.add_book_in_favorites("Гарри Поттер") | ||
| result = collector.get_list_of_favorites_books() | ||
| assert isinstance(result, list) |
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.
Нужно исправить: тест не отличается от test_add_book_in_favorites_adds_once. Установи значение избранного напрямую или иначе проверь состояние списка в тесте добавления
No description provided.