def test_donor_letter(self): donor_set = DonorData.DonorData( [Donor.Donor('MoneyMan', [25.00, 150.00, 2000.00, 100000.00])]) donor_set.save_letters() with open('MoneyMan.txt', 'r') as myfile: letter_txt = myfile.read() with open('MoneyMan_test.txt', 'r') as myfile: letter_test = myfile.read() self.assertEqual(letter_txt, letter_test)
def addshortcuts(self): f = Frame(self.master, bd=1, relief=SUNKEN) f.pack() photo = PhotoImage(file="./images/bill.png") b = Button(f, image=photo, text="bill", compound=BOTTOM, width=100, height=100, command=lambda: bill.Bill()) b.pack(side=LEFT) b.image = photo photo = PhotoImage(file="./images/purchase.png") b = Button(f, image=photo, text="purchase", compound=BOTTOM, width=100, height=100, command=lambda: purchase.addStock()) b.pack(side=LEFT) b.image = photo photo = PhotoImage(file="./images/patient.png") b = Button(f, image=photo, text="patient", compound=BOTTOM, width=100, height=100, command=lambda: patient.Patient()) b.pack(side=LEFT) b.image = photo photo = PhotoImage(file="./images/donor.png") b = Button(f, image=photo, text="donor", compound=BOTTOM, width=100, height=100, command=lambda: donor.Donor()) b.pack(side=LEFT) b.image = photo photo = PhotoImage(file="./images/new.png") b = Button(f, image=photo, text="Services", compound=BOTTOM, width=100, height=100, command=lambda: service.Inv()) b.pack(side=LEFT) b.image = photo
def test_mailroom_functions(self): donor1 = dr.Donor("Steven", "Hawking", [326892.24, 123, 123.33, 123, 123]) donor2 = dr.Donor("Justin", "Timberlake", [999658.25, 1233, 123]) test_donorfunctions = dr.DonorFunctions([donor1, donor2]) donor3 = dr.Donor("Jeff", "Bezos", [52636.27]) test_donorfunctions.add_donor(donor3) self.assertEqual(test_donorfunctions.donorslist[1].lastname, 'Timberlake') self.assertEqual(test_donorfunctions.donorslist[0].firstname, 'Steven') self.assertEqual(test_donorfunctions.donorslist[0].donations, [326892.24, 123, 123.33, 123, 123]) self.assertEqual(test_donorfunctions.donorslist[2].fullname, 'Jeff Bezos') self.assertEqual(test_donorfunctions.donorslist[2].donations, [52636.27]) self.assertEqual(test_donorfunctions.get_all_donors(), ["Steven Hawking", "Justin Timberlake", "Jeff Bezos"])
def test_donor(self): test_donor = dr.Donor("Tina", "Brownfield", [250.25]) self.assertEqual(test_donor.firstname, "Tina") self.assertEqual(test_donor.lastname, "Brownfield") self.assertEqual(test_donor.donations, [250.25]) self.assertEqual(test_donor.fullname, "Tina Brownfield") self.assertTrue(test_donor.fullname == "Tina Brownfield", msg=(test_donor.fullname, "Tina Brownfield")) test_donor.add_donation(72.75) self.assertEqual(test_donor.donations, [250.25, 72.75]) self.assertTrue(test_donor.donations == [250.25, 72.75], msg=(test_donor.donations, [250.25, 72.75])) self.assertTrue(test_donor.donation_count() == 2, msg=(test_donor.donation_count(), 2)) self.assertTrue(test_donor.average_donation() == 161.5, msg=(test_donor.average_donation(), 161.5)) self.assertTrue(test_donor.donations_total() == 323, msg=(test_donor.donations_total(), 323))
def initial_donor_set(): return [ Donor.Donor('Jim', [25.00, 150.00, 2000.00, 100000.00]), Donor.Donor('Linda', [10000.25]), Donor.Donor('Bob', [5.03, 100.01, 6.00]) ]
def test_donor_name(self): donor = Donor.Donor('MoneyMan', [1000000000, 2000000000]) self.assertEqual(donor.name, 'MoneyMan')
def test_donor_avg_donnation(self): donnor = Donor.Donor('MoneyMan', [1000000000, 2000000000]) self.assertEqual(donnor.avg_donation, 1500000000)
def test_donor_total_donnation(self): donor = Donor.Donor('MoneyMan', [1000000000, 2000000000]) self.assertEqual(donor.total_donations, 3000000000)
def add_donor(self, name): donor = Donor.Donor(name) self.donor_dict[donor.name] = donor return donor