Example #1
0
def test_create_ticket_lookup_dict_pass_in_empty_dict():
    output = raffle_program.create_ticket_lookup_dict({})
    assert output == {}
Example #2
0
def test_create_ticket_lookup_dict_invalid_value_type():
    with pytest.raises(TypeError) as e:
        raffle_program.create_ticket_lookup_dict({1: "2"})

    assert str(
        e.value) == "All the values in the donation dict must be integers"
Example #3
0
def test_create_ticket_lookup_dict_pass_in_string():
    with pytest.raises(TypeError) as e:
        raffle_program.create_ticket_lookup_dict("1,2,3")

    assert str(e.value) == "Must pass a dictionary to this function"
Example #4
0
def test_create_ticket_lookup_dict_returns_expected_data():
    expected_out = {0: 0, 1: 0, 2: 0, 3: 1, 4: 1, 5: 1}

    output = raffle_program.create_ticket_lookup_dict(TEST_DONATION_TICKET_DEF)
    assert output == expected_out