-
Notifications
You must be signed in to change notification settings - Fork 0
Закончен #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?
Закончен #5
Conversation
tests.py
Outdated
|
|
||
| # напиши свои тесты ниже | ||
| # чтобы тесты были независимыми в каждом из них создавай отдельный экземпляр класса BooksCollector() | ||
| # чтобы тесты были независимыми в каждом из них создавай отдельный экземпляр класса 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.
Нужно исправить: в примере неверный ассерт. Исправь его или убери тест
tests.py
Outdated
| # чтобы тесты были независимыми в каждом из них создавай отдельный экземпляр класса BooksCollector() | ||
| # Тестирование добавления одной книги | ||
| def test_add_new_book_single_book(self): | ||
| 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.
Можно улучшить: предусловие, общее для всех тестов, лучше вынести в фикстуру
tests.py
Outdated
| [("Алиса в стране чудес", "Мультфильмы"), | ||
| ("Франкенштейн", "Ужасы"), | ||
| ("Код да Винчи", "Детективы")]) | ||
| def test_get_book_genre(self, book_name, genre): |
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.
Нужно исправить: тест аналогичен set_book_genre. Попробуй установить значение жанра иначе, или иначе получить его для сравнения. Используй доступ к словарю
tests.py
Outdated
| for book in books: | ||
| collector.add_new_book(book) | ||
| collector.set_book_genre(book, genre) | ||
| result = collector.get_books_with_specific_genre(genre) |
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.
Можно улучшить: задача метода - выбор нужных книг из списка, а в тесте возвращаются все.
tests.py
Outdated
| collector.add_new_book(book_name) | ||
| collector.set_book_genre(book_name, genre) | ||
| children_books = collector.get_books_for_children() | ||
| assert book_name in children_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.
Нужно исправить: не протестировано, что метод выбирает нужные книги
tests.py
Outdated
| collector.add_book_in_favorites(book_name) | ||
|
|
||
| # Проверяем добавление в избранное | ||
| assert book_name in collector.favorites |
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.
Нужно исправить: добавление проверено в прошлом тесте
No description provided.