def test_load():
    donors.load("test_donors.json")
    donor = donors.find_donor("Bill Ted")
    assert donor is None
    donor = donors.find_donor("Json Donor 1")
    donor2 = Donor("Json Donor 1", [4.50, 3.45])
    assert donor == donor2
def test_save():
    donors.load("test_donors.json")
    donors.add_donor(Donor("Json Donor 2", [5.50, 5.45]))
    donors.save("test_donors_save.json")
    donors.load("test_donors.json")
    donor = donors.find_donor("Json Donor 2")
    assert donor is None
    donors.load("test_donors_save.json")
    donor = donors.find_donor("Json Donor 2")
    donor2 = Donor("Json Donor 2", [5.50, 5.45])
    assert donor == donor2
def test_create_thank_you():
    donor = donors.find_donor("Bill Ted")
    assert donor.create_thank_you(5) == (
        "Dear Bill Ted,\nThank you for your very generous donation of $5.00.  "
        "It \nwill go very far in supporting the Human Fund, \"Money for \nPeople.\"\n"
        "                               Sincerely\n                                      Art Vandelay"
    )
def test_name():
    donor = donors.find_donor("Lisa Grant")
    assert donor.name == "Lisa Grant"
    donor = donors.find_donor("Frank Fred")
    assert donor.name == "Frank Fred"
def test_num_donations():
    donor = donors.find_donor("Lisa Grant")
    assert donor.num_donations == 2
    donor = donors.find_donor("Frank Fred")
    assert donor.num_donations == 3
def test_avg_donations():
    donor = donors.find_donor("Lisa Grant")
    assert donor.avg_donation == 104.85
    donor = donors.find_donor("Bill Ted")
    assert donor.avg_donation == 242.21
def test_total_donations():
    donor = donors.find_donor("Lisa Grant")
    assert donor.total_donations == 209.70
    donor = donors.find_donor("Frank Fred")
    assert donor.total_donations == 178.76
def test_find_donor():
    assert donors.find_donor("dne") is None
    assert donors.find_donor("Bill Ted") == Donor("Bill Ted",
                                                  [353.53, 348.1, 25.00])