Skip to content

Conversation

@emilkabals
Copy link
Owner

Добавлен README и тесты для BooksCollector


class TestBooksCollector:
#Фикстура collector - создает новый экземпляр класса для каждого теста
@pytest.fixture

Choose a reason for hiding this comment

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

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

assert collector.get_list_of_favorites_books() == ['Скотный двор', 'Мы']

# Проверяем что метод get_book_genre возвращает правильный жанр
def test_get_book_genre(self, collector):

Choose a reason for hiding this comment

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

Нужно исправить: тест аналогичен set_book_genre. Попробуй установить значение жанра иначе, или иначе получить его для сравнения. Используй доступ к словарю. В идеале - в каждом тесте нужно использовать только один проверяемый метод

])
def test_add_new_book(self, collector, name, expected):
collector.add_new_book(name)
assert (name in collector.get_books_genre()) == expected

Choose a reason for hiding this comment

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

Нужно исправить: нужны отдельные тесты для add_new_book и get_books_genre()

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