示例#1
0
def test_thankyou_note():
    M_S = Donor("Morgan Stanley")
    M_S.donations = [10]
    M_S.append(7.50)

    assert M_S.thank_you(
    ) == "Thanks Morgan Stanley for your $17.50 in donations."
示例#2
0
def test_thankyou_email():
    '''Test email text'''
    M_S = Donor("Morgan Stanley")
    M_S.donations = [10]
    M_S.append(7.5)

    assert M_S.email().startswith("Greetings Morgan Stanley")
    assert M_S.email().endswith("(DZCAWCRG)\n")
示例#3
0
def test_print_report():
    '''Confirm list sorting before printing'''
    dc = Donor_Collect()
    JDR = Donor('John D. Rockefeller')
    JDR.donations = [1500]
    dc.append(JDR)

    EJ = Donor('Elton John')
    EJ.donations = [1600]
    dc.append(EJ)

    temp_list = dc.print_report()

    assert isinstance(temp_list, list)
    assert isinstance(temp_list[0], tuple)
    assert temp_list[0][0] == str(EJ)
    assert temp_list[1][0] == str(JDR)
示例#4
0
def test_init_donation():
    '''Creating first donation'''
    Paul = Donor('Paul')
    Paul.donations = [15]

    assert Paul.donations == [15]
    Paul.append([16, 17])
    assert Paul.donations == [15, 16, 17]
示例#5
0
def test_sum_gift():
    DC = Donor_Collect()
    WG = Donor('Bill Gates')
    WG.donations = [15]
    WG.append([16, 17])
    DC.append(WG)
    new_dict = DC.calc_report()

    print(new_dict)

    assert isinstance(new_dict, dict)
    assert new_dict[repr(WG)] is not None
    assert new_dict[repr(WG)][0] == 48.0
    assert new_dict[repr(WG)][1] == 3
    assert new_dict[repr(WG)][2] == 16.0