def test_self_checkout_many_items() -> None:
    """ Test self serve line checkout time for customer with many items."""
    line = SelfServeLine(1)
    item_list = [Item('bananas', 1), Item('apples', 2), Item('kiwis', 3)]
    jeff = Customer('Jeff', item_list)
    line.accept(jeff)
    assert line.start_checkout() == 12
def test_self_checkout_no_items() -> None:
    """ Test self serve line checkout time for customer with no items."""
    line = SelfServeLine(1)
    item_list = []
    jeff = Customer('Jeff', item_list)
    line.accept(jeff)
    assert line.start_checkout() == 0
def test_self_start_checkout_test() -> None:
    line = SelfServeLine(3)
    c1 = Customer("John", [Item("milk", 2), Item("lid", 1), Item("fan", 3)])
    c2 = Customer("Jim", [Item("milk", 2), Item("lid", 1), Item("fan", 5)])
    c3 = Customer("James", [Item("milk", 2), Item("lid", 1), Item("fan", 33)])
    c4 = Customer("Janice", [Item("milk", 2), Item("lid", 1), Item("fan", 23)])
    for item in [c1, c2, c3, c4]:
        if line.can_accept(item):
            line.accept(item)
    assert line.start_checkout() == 12
    assert len(line) == 3
    assert line.start_checkout() == 12
    assert line.complete_checkout() is True
    assert line.start_checkout() == 16
    assert line.complete_checkout() is True
    assert line.start_checkout() == 72
    assert line.complete_checkout() is False
    assert line.start_checkout() == 0
    assert line.complete_checkout() is False
Пример #4
0
def test_start_checkout() -> None:
    """Test the start_checkout function of the Checkout Class."""
    a = RegularLine(3)
    b = ExpressLine(3)
    c = SelfServeLine(3)
    c1 = Customer('A', [Item('bananas', 7)])
    c2 = Customer('B', [])
    c3 = Customer('C', [Item('orange', 5)])
    c4 = Customer('D', [Item('grapes', 10), Item('avacado', 1)])
    a.queue = [c1]
    b.queue = [c2, c3]
    c.queue = [c4]
    assert a.start_checkout() == 7
    a.queue = [c1, c2]
    assert a.start_checkout() == 7
    assert b.start_checkout() == 0
    b.queue = [c3]
    assert b.start_checkout() == 5
    assert c.start_checkout() == 22
    c.queue = [c1, c2, c3, c4]
    assert c.start_checkout() == 14
Пример #5
0
def test_self_served_line_checkout_started() -> None:
    """test for checkout started for self serve line"""
    customer1 = Customer("bruce", [
        Item("banana", 10),
        Item("banana", 10),
        Item("banana", 10),
        Item("banana", 10),
        Item("banana", 10),
        Item("banana", 10),
        Item("banana", 10),
        Item("banana", 10),
        Item("banana", 10)
    ])
    customer2 = Customer("tom", [Item("banana", 10), Item("banana", 10)])
    line1 = SelfServeLine(3)
    assert line1.accept(customer1) is True
    assert line1.accept(customer2) is True
    assert line1.start_checkout() == 180
def test_self_empty_line() -> None:
    line = SelfServeLine(3)
    assert line.complete_checkout() is False
    assert line.start_checkout() == 0