Skip to content

Feat: add pytest for TestBooksCollector#8

Open
zhulevk-gif wants to merge 2 commits into
mainfrom
develop
Open

Feat: add pytest for TestBooksCollector#8
zhulevk-gif wants to merge 2 commits into
mainfrom
develop

Conversation

@zhulevk-gif

Copy link
Copy Markdown
Owner

No description provided.

Comment thread __pycache__/main.cpython-313.pyc Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Нужно исправить: из финального проекта нужно удалить все файлы и папки, которые не относятся к решению задачи

Comment thread tests.py
collector.add_new_book('Гордость и предубеждение')
assert 'Гордость и предубеждение' in collector.get_books_genre()

@pytest.mark.parametrize('name', ['', 'Название книги, которое длиннее сорока одного символа'])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Отлично: удачное применение параметризации, протестированы разные граничные значения для длины имени

Comment thread tests.py
assert name not in collector.get_books_genre()

def test_set_book_genre_existing_genre(self):
collector = BooksCollector()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Отлично: в каждом тесте создается собственный экземпляр BooksCollector, но можно лучше - перенести создание экземпляра в фикстуры в отдельный файл conftest, а не повторять это предусловие в каждом тесте

@zhulevk-gif zhulevk-gif reopened this Mar 24, 2026
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