Beispiel #1
0
def send_thank_you():
    """
    Prints a in a nicely formatted message that contains the 
    table/titles that will organize  donor name, the total amount 
    they have donated, the number of donations, and their 
    corresponding average gift amount in a neat formatted manner.
    """

    donor = validate(
        "Please type a donor's full name or type 'list' to view donors\n>>> "
    ).title()

    while donor == "List":
        # Prints a list of donors for the user to view
        print(donor_collection.generate_list_of_names())
        donor = validate(
            "Type donor's name or 'list' to print names again\n>>>").title()

    donor_to_thank = donor_collection.find_donor(donor)
    donation_amt = get_donation_amt()

    if donor_to_thank:
        donor_to_thank.add_donation(donation_amt)
    else:
        donor_to_thank = Donor(donor, donation_amt)
        donor_collection.add_donor(donor_to_thank)

    print(donor_to_thank.__str__())
Beispiel #2
0
 def test_donor_str(self, test_input):
     donor = Donor(test_input[0], test_input[1])
     assert donor.__str__() == f"Donor: {test_input[0]}, Donations: {test_input[1]}"