Ejemplo n.º 1
0
def test_generate_email():
    # Test that email is properly generated
    d = Donor('Eleanor Shellstrop')
    donations_to_add = [100., 50.]
    for amount in donations_to_add:
        d.addDonation(amount)
    assert d.generateEmail() == """Dear Eleanor Shellstrop,
Ejemplo n.º 2
0
def test_add_donation():
    # Test that donations can be added, and that last/total donations work
    d = Donor('Eleanor Shellstrop')
    donations_to_add = [100., 50., 150.]
    for amount in donations_to_add:
        d.addDonation(amount)
    assert d.donations == donations_to_add
    assert d.lastDonation() == 150.
    assert d.totalDonations() == 300.
    assert d.averageDonation() == 100.
    assert d.numDonations() == 3