-
Notifications
You must be signed in to change notification settings - Fork 0
sprint 4 #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
tests.py
Outdated
|
|
||
| def test_add_new_book_add_two_books(self): | ||
| # создаем экземпляр (объект) класса BooksCollector | ||
| 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
| collector = BooksCollector() | ||
| collector.add_new_book('Дюна') | ||
| collector.set_book_genre('Дюна', 'Детективы') | ||
| assert collector.get_book_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.set_book_genre('1984', 'Фантастика') | ||
| assert collector.get_book_genre('1984') is None | ||
|
|
||
| def test_get_book_genre(self): |
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('Дюна') | ||
| collector.set_book_genre('Дюна', 'Фантастика') | ||
| collector.set_book_genre('Дюна', 'Драма') | ||
| assert collector.get_book_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('Пикник на обочине') | ||
| assert collector.get_book_genre('Пикник на обочине') == '' | ||
|
|
||
| def test_get_book_genre_after_setting(self): |
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_set_book_genre_first_set.
Установи жанр иначе или сравнивай то, что возвращает метод со значением, полученным из словаря напрямую
No description provided.