Created
January 4, 2021 21:14
-
-
Save klement97/6162b28a8e5c149d2c9fc0b7ef8b8128 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.mark.django_db | |
@pytest.mark.parametrize('number_of_toppings', list(range(0, 10))) | |
def test_pizza_price(number_of_toppings): | |
# Preparation phase | |
pizza = create_pizza(number_of_toppings=number_of_toppings) | |
# Calculating results | |
actual_price = pizza.total_price | |
expected_price = Decimal(sum([t.price for t in pizza.toppings.all()])) | |
# Assertion | |
assert actual_price == expected_price |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment