def test_get_formatted_values(self): donations_list = Donations() donations_list.add_donation("Tom Cruise", 100) donations_list.add_donation("Michael Jordan", 200) donations_list.add_donation("Katy Perry", 300) tst_list = "List of Donors: Tom Cruise, Michael Jordan, Katy Perry" self.assertEqual(tst_list, donations_list.get_formatted_list_of_donors())
def test_averages(self): donations_list = Donations() donations_list.add_donation("Jeff Bezos", 100) donations_list.add_donation("Jeff Bezos", 200) donations_list.add_donation("Jeff Bezos", 300) test_values = {"Jeff Bezos": [100, 200, 300]} self.assertDictEqual({'Jeff Bezos': 200}, donations_list.avg_donations)
def test_sum_values(self): donations_list = Donations() donations_list.add_donation("Bill Gates", 100) donations_list.add_donation("Bill Gates", 200) donations_list.add_donation("Bill Gates", 300) test_compare = {'Bill Gates': 600} self.assertDictEqual(test_compare, donations_list.donation_totals)
def test_num_gifts(self): donations_list = Donations() donations_list.add_donation("Bill Gates", 100) donations_list.add_donation("Bill Gates", 200) donations_list.add_donation("Bill Gates", 300) test_values = {"Bill Gates": [100, 200, 300]} self.assertDictEqual({'Bill Gates': 3}, donations_list.num_donations)
#!/usr/bin/env python3 import sys import re from donor_class import Donations from donor_class import Donor # List of donors and donation amounts donations_list = Donations() donor_list = Donor() donations_list.add_donation("Tom Cruise", 100) donations_list.add_donation("Tom Cruise", 200) donations_list.add_donation("Tom Cruise", 300) donations_list.add_donation("Michael Jordan", 1300) donations_list.add_donation("Katy Perry", 4500) donations_list.add_donation("Katy Perry", 1500) donations_list.add_donation("Adam Sandler", 500) donations_list.add_donation("Adam Sandler", 2400) def main(): # Menu options options = { 1: send_thank_you, 2: create_report, 3: send_letters, 4: challenge, 5: sys.exit