Exemplo n.º 1
0
def test_add_donation():
    donors = Donors()
    donors.add_donation("Mark", 10)
    assert donors.get_donor("Mark") == Donor("Mark", 10)
    donors.add_donation("Mark", 20)
    assert donors.get_donor("Mark").donations == (10, 20)
    donors.add_donation("Mary", 30)
    assert donors.get_donor("Mary") == Donor("Mary", 30)
    assert set(donors.names) == set(["Mark", "Mary"])
Exemplo n.º 2
0
def test_get_donor():
    donors = Donors()
    d = Donor("Mark", 50)
    donors.add_donor(d)
    assert donors.get_donor("Mark") == d
    assert donors.get_donor("Mary") is None