Skip to content

Sprint_4#6

Open
Julia-koroleva wants to merge 17 commits intomainfrom
Sprint_4
Open

Sprint_4#6
Julia-koroleva wants to merge 17 commits intomainfrom
Sprint_4

Conversation

@Julia-koroleva
Copy link
Owner

Добрый день!
В ветке develop представлены мои юнит-тесты

assert len(collector.get_books_genre()) == 2

def test_add_new_book_add_two__equal_books_failed(self):
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(name)
collector.set_book_genre(name, genre)
assert collector.get_book_genre(name) == genre
Copy link

Choose a reason for hiding this comment

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

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

books_for_children = collector.get_books_for_children()
assert len(books_for_children) != books_with_specific_genre

def test_get_list_of_favorites_books_success(self):
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 = BooksCollector()
collector.add_new_book('Джейн Эйр')
collector.add_new_book('Джейн Эйр')
assert len(collector.get_books_genre()) == 1
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

Comments