Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Выполненое Задание №1 #202

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

NataliyPonomareva
Copy link

No description provided.

Comment on lines 10 to 12
def test_bun_initialization(self, name, price):
bun = Bun(name, price)
assert bun.get_name() == name and bun.get_price() == price

Choose a reason for hiding this comment

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

Нужно исправить: это юнит тесты, должен быть отдельный тест на отдельный метод

Comment on lines 13 to 28
mock_bun = Mock(spec=Bun)
mock_bun.get_name.return_value = MockBurger.BUN_NAME
mock_bun.get_price.return_value = MockBurger.BUN_PRICE

mock_ingredient = Mock(spec=Ingredient)
mock_ingredient.get_price.return_value = MockBurger.INGREDIENT_PRICE
mock_ingredient.get_name.return_value = MockBurger.INGREDIENT_NAME
mock_ingredient.get_type.return_value = MockBurger.INGREDIENT_TYPE

another_mock_ingredient = Mock(spec=Ingredient)
another_mock_ingredient.get_price.return_value = MockBurger.ANOTHER_INGREDIENT_PRICE
another_mock_ingredient.get_name.return_value = MockBurger.ANOTHER_INGREDIENT_NAME
another_mock_ingredient.get_type.return_value = MockBurger.ANOTHER_INGREDIENT_TYPE

# Инициализируем бургер с булочкой
burger = Burger()

Choose a reason for hiding this comment

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

Можно лучше: очень сложный объект, стоит создавать несколько более маленьких объектов с локальной логикой, чтобы не пришлось это отправлять в каждый тест а использовать только 1 или 2 элемента из кортежа

@pytest.mark.parametrize("ingredient_type, name, price", IngredientData.INGREDIENT_DATA)
def test_ingredient_initialization(self, ingredient_type, name, price):
ingredient = Ingredient(ingredient_type, name, price)
assert ingredient.get_type() == ingredient_type and ingredient.get_name() == name and ingredient.get_price() == price

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