Skip to content

Conversation

@Modmoonka
Copy link

No description provided.

Copy link

@irisqul irisqul left a comment

Choose a reason for hiding this comment

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

✅ Сильные стороны:

  • Код запускается без ошибок
  • Тестовая архитектура соответствует изученным практикам написания автотестов
  • Обеспечено необходимое тестовое покрытие

db = Database()
ingredients = db.available_ingredients()
assert len(ingredients) == 6
assert isinstance(ingredients[0], Ingredient)
Copy link

Choose a reason for hiding this comment

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

Можно лучше: мы тестируем не атрибуты экземпляров класса или наполнение базы данных, а методы приложения. Необходимо добавить шаги в которых будут использованы методы и проверить результат. Базу данных тестировать юниттестами не получится

bun.get_price.return_value = 60
burger.set_buns(bun)

ingredient = Mock()
Copy link

Choose a reason for hiding this comment

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

Отлично: благодаря мокам тесты стали быстрее и управляемее, теперь они меньше зависят от внешних данных

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