def test_donor_setter(): d = Donor('Nam Vo', [100, 50.0]) d.name = 'Vu Vo' d.donations = [40, 55.5] print(f"d = {d}") assert (d.name) == 'Vu Vo' assert (d.donations) == [40.0, 55.5] with pytest.raises(TypeError): d.name = 1000 with pytest.raises(ValueError): d.donations = [30, -15]
def test_new_donor(): d = Donor('John Smith') assert d.name == 'John Smith' assert str(d) == 'John Smith' assert repr(d) == 'John Smith' d.name = 'Jane Doe' assert d.name == 'Jane Doe' assert str(d) == 'Jane Doe' assert repr(d) == 'Jane Doe'