コード例 #1
0
def test_donors_summary_report_multiple_names_multiple_values_sorting():
    db = Donors({
        "A Name": [1, 2, 3, 4, 5],
        "B Name": [6.75, 7.75, 8.50],
        "C Name": [20.6789]
    })
    expected = "DONOR NAME             TOTAL DONATED   NUM DONATIONS   AVG DONATION\n" \
               "B Name                 $       23.00   3               $       7.67\n" \
               "C Name                 $       20.68   1               $      20.68\n" \
               "A Name                 $       15.00   5               $       3.00\n"
    assert db.summary_report() == expected
コード例 #2
0
def test_donors_summary_report_one_name_one_value():
    db = Donors({"A Name": [0]})
    expected = "DONOR NAME             TOTAL DONATED   NUM DONATIONS   AVG DONATION\n" \
               "A Name                 $        0.00   1               $       0.00\n"
    assert db.summary_report() == expected
コード例 #3
0
def test_donors_summary_report_one_name_multiple_values():
    db = Donors({"A Name": [1, 2, 3, 4, 5]})
    expected = "DONOR NAME             TOTAL DONATED   NUM DONATIONS   AVG DONATION\n" \
               "A Name                 $       15.00   5               $       3.00\n"
    assert db.summary_report() == expected
コード例 #4
0
def test_donors_summary_report_empty_db():
    db = Donors()
    expected = "DONOR NAME             TOTAL DONATED   NUM DONATIONS   AVG DONATION\n"
    assert db.summary_report() == expected