Пример #1
0
def test_update():
    pizza = Pizza(['pepperoni', 'small', ['chicken', 'olives']])
    assert pizza.get_size() == 'small'
    pizza.update([-1, 'medium', -1])
    assert pizza.get_size() == 'medium'

    pizza = Pizza(['vegetarian', 'medium', ['beef', 'olives']])
    assert pizza.get_type() == 'vegetarian'
    pizza.update(['pepperoni', -1, -1])
    assert pizza.get_type() == 'pepperoni'

    pizza = Pizza(['vegetarian', 'small', ['chicken', 'beef']])
    assert pizza.get_toppings() == ['chicken', 'beef']
    pizza.update([-1, -1, ['olives']])
    assert pizza.get_toppings() == ['olives']

    pizza = Pizza(['pepperoni', 'small', ['chicken', 'olives']])
    assert not pizza.update([-1, 'invalid', -1])

    pizza = Pizza(['vegetarian', 'medium', ['beef', 'olives']])
    assert not pizza.update(['invalid', -1, -1])

    pizza = Pizza(['vegetarian', 'small', ['chicken', 'beef']])
    assert not pizza.update([-1, -1, 'invalid'])
Пример #2
0
def test_get_size():
    pizza = Pizza(['pepperoni', 'small', ['chicken', 'olives']])
    assert pizza.get_type() == 'pepperoni'

    pizza = Pizza(['vegetarian', 'medium', ['beef', 'olives']])
    assert pizza.get_type() == 'vegetarian'