Skip to content

Conversation

@iermonakhovagalina
Copy link
Collaborator

No description provided.

tests.py Outdated

@pytest.mark.parametrize("name", ["", "A" * 41])
def test_add_new_book_invalid_name(self, name):
collector = BooksCollector()
Copy link

Choose a reason for hiding this comment

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

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

collector = BooksCollector()
collector.add_new_book("Вокруг света за 80 дней")
collector.set_book_genre("Вокруг света за 80 дней", "Приключения")
assert collector.get_book_genre("Вокруг света за 80 дней") == "Приключения"
Copy link

Choose a reason for hiding this comment

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

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

tests.py Outdated
collector = BooksCollector()
collector.add_new_book("Вокруг света за 80 дней")
collector.add_book_in_favorites("Вокруг света за 80 дней")
assert "Вокруг света за 80 дней" in collector.get_list_of_favorites_books()
Copy link

Choose a reason for hiding this comment

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

Нужно исправить: для get_list_of_favorites_books тоже нужен отдельный тест

collector.add_new_book("Вокруг света за 80 дней")
collector.set_book_genre("Вокруг света за 80 дней", "Приключения")
# проверяем напрямую словарь, а не через get_book_genre
assert collector.get_books_genre()["Вокруг света за 80 дней"] == "Приключения"
Copy link

Choose a reason for hiding this comment

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

Нужно исправить: для 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.

2 participants