def test_add_donor():
    db = DonorCollection()
    db.add_donor(Donor("Rick", [9, 9, 9]))
    assert db.donors["rick"].donations == [9, 9, 9]
    db.add_donor(Donor("Bob", [1, 2, 3]))
    assert db.donors["bob"].donations == [1, 2, 3]
    assert db.donors["rick"].donations == [9, 9, 9]
from donors_models import Donor, DonorCollection, standardize_name, valid_donation
import sys, os
""" Initialize data"""
db = DonorCollection([
    Donor("Fred Flintstone", [100, 200, 50]),
    Donor("James Bond", [0, 0, 7]),
    Donor("Lex Luthor", [
        5000,
    ]),
    Donor("Harambe", [3, 2, 1]),
    Donor("Herman Cain", [9, 9, 9]),
    Donor("Placeholder Guy")
])


def requested_list(userEntry):
    return (userEntry.lower() == 'list') or (userEntry.lower() == 'l')


def print_donor_list():
    print()
    print("Donor List")
    print("----------")
    [print(name) for name in db.name_list]
    print()


def print_thank_you(donor, donation):
    print(
        "Thank you {} for your generous donation of ${} from a charity".format(
            donor, donation))
def test_load_db():
    db = DonorCollection([Donor("Rick", [9, 9, 9]), Donor("Bob", [1, 2, 3])])
    assert db.donors["bob"].donations == [1, 2, 3]
    assert db.donors["rick"].donations == [9, 9, 9]
def test_empty_db():
    db = DonorCollection()
def test_create_empty_db():
    db = DonorCollection()
    assert db.donors == {}
def test_stats_sort():
    db = DonorCollection([Donor("Other", [1, 3]), Donor("Rick", [9, 9, 9])])
    assert db.stats_sorted == [("Rick", 27, 3, 9), ("Other", 4, 2, 2)]
def test_name_list():
    db = DonorCollection([Donor("Rick", [9, 9, 9])])
    assert db.name_list == ["Rick"]
    db = DonorCollection([Donor("Rick", [9, 9, 9]), Donor("Other", [1, 3])])
    assert db.name_list == ["Rick", "Other"]
def test_donor_present():
    db = DonorCollection([Donor("Rick", [9, 9, 9]), Donor("Bob", [1, 2, 3])])
    assert db.donor_present("Rick")
    assert db.donor_present("boB")
    assert not db.donor_present("Carlos")