Skip to content

Conversation

@Lnvdd
Copy link
Owner

@Lnvdd Lnvdd commented Sep 25, 2025

No description provided.

@Lnvdd Lnvdd changed the title Выполнено задание для sprint 4 sprint 4 Sep 25, 2025
tests.py Outdated

def test_add_new_book_add_two_books(self):
# создаем экземпляр (объект) класса BooksCollector
collector = BooksCollector()

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('Дюна') == 'Детективы'

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):
Copy link

@Ayantea1 Ayantea1 Sep 26, 2025

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('Дюна') == 'Фантастика'
Copy link

@Ayantea1 Ayantea1 Sep 29, 2025

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):

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.
Установи жанр иначе или сравнивай то, что возвращает метод со значением, полученным из словаря напрямую

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants