Пример #1
0
def test_array_to_dict():
    ticket_array = VIFTicketArray(record_code='q30')
    ticket_array.add_ticket(ticket_code='BOUNT00',
                            ticket_price=5,
                            ticket_service_fee=1)
    expected = {100101: 'BOUNT00', 100102: 5, 100103: 1}
    assert ticket_array.data() == expected
Пример #2
0
def test_count_ticket_array():
    ticket_array = VIFTicketArray(record_code='q30')
    ticket_array.add_ticket(ticket_code='BOUNT00',
                            ticket_price=5,
                            ticket_service_fee=1)
    ticket_array.add_ticket(ticket_code='BOUNT00',
                            ticket_price=5,
                            ticket_service_fee=1)
    ticket_array.add_ticket(ticket_code='BOUNT00',
                            ticket_price=5,
                            ticket_service_fee=1)

    assert ticket_array.count() == 3
Пример #3
0
def test_sum_ticket_prices():
    ticket_array = VIFTicketArray(record_code='q30')
    ticket_array.add_ticket(ticket_code='BOUNT00',
                            ticket_price=5,
                            ticket_service_fee=1)
    ticket_array.add_ticket(ticket_code='BOUNT00',
                            ticket_price=5,
                            ticket_service_fee=1)
    ticket_array.add_ticket(ticket_code='BOUNT00',
                            ticket_price=5,
                            ticket_service_fee=1)

    assert ticket_array.total_ticket_prices() == 15
Пример #4
0
def test_array_maps_p30_keys():
    ticket_array = VIFTicketArray(record_code='p30')
    ticket_array.add_ticket(ticket_code='BOUNT00',
                            ticket_price=5,
                            ticket_service_fee=1)
    ticket_array.add_ticket(ticket_code='BOUNT00',
                            ticket_price=5,
                            ticket_service_fee=1)
    ticket_array.add_ticket(ticket_code='BOUNT00',
                            ticket_price=5,
                            ticket_service_fee=1)
    expected = {
        100101: 'BOUNT00',
        100103: 5,
        100108: 1,
        100201: 'BOUNT00',
        100203: 5,
        100208: 1,
        100301: 'BOUNT00',
        100303: 5,
        100308: 1
    }
    assert ticket_array.data() == expected