Skip to content

Conversation

@polinka53
Copy link
Owner

No description provided.

from books_collector import BooksCollector


@pytest.fixture

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно улучшить: фикстуры стоит хранить в отдельном модуле

collector.add_new_book("Книга")
collector.set_book_genre("Книга", genre)
expected = genre if should_set else ""
assert collector.get_book_genre("Книга") == expected

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)

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. Установи значение избранного напрямую или иначе проверь состояние списка в тесте добавления

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