def test_add_donation(): dl = Donorlist(init_tuple) dl.add_donation('Nick Offerman', 250) dl.add_donation('Nick Offerman', 55) assert 250 in dl.list_donations('Nick Offerman') assert 55 in dl.list_donations('Nick Offerman') with pytest.raises(KeyError): dl.add_donation('Nobody', 20)
def test_add_donor(): dl = Donorlist(init_tuple) dl.add_donor('Gene Shallit') assert 'Gene Shallit' in dl.list_donors() assert isinstance(dl.get_donor('Gene Shallit'), Donor) assert dl.list_donations('Gene Shallit') == [] with pytest.raises(ValueError): dl.add_donor('Tom Selleck')
def test_list_donation(): dl = Donorlist(init_tuple) assert dl.list_donations('John Waters') == [20.0, 20.0, 20.0] with pytest.raises(ValueError): dl.list_donations('Freddie Mercury')