示例#1
0
 def test_list_donors(self, donors):
     donor_names = [
         'Michael Bloomberg', 'Bill Ackerman', 'David Einhorn',
         'Seth Klarman', 'Mark Zuckerberg'
     ]
     assert bool(mailroom.list_donors(**donors)) is True
     assert type(mailroom.list_donors(**donors)) is list
     assert all(names in donor_names
                for names in mailroom.list_donors(**donors))
示例#2
0
def test_list_donors():
    """
    Tests if the list operation is showing all the donor name correctly
    """
    result = mailroom.list_donors()
    assert "Jeff Bezos" in result
    assert len(result) == 4
示例#3
0
def test_list_donors():
    listing = mr.list_donors()

    print(listing)
    assert listing.startswith("Donor List:\n")
    assert "Yosemite Sam" in listing
    assert "Wile E. Coyote" in listing
    assert len(listing.split('\n')) == 7
def test_list_donors():
    "Verify that all of the donor names are printed to stdout"

    # Re-direct output to the terminal to the StringIO object output
    output = io.StringIO()
    sys.stdout = output
    mr.list_donors()
    # Reset stdout
    sys.stdout = sys.__stdout__

    # change the position to the begginning of the stream:
    output.seek(0)
    # Read all of the names output by the list_donors() function into a set
    # don't include the newline character when reading in the names
    names_out = {name[:-1] for name in output if len(name[:-1]) > 0}

    # Loop through the donors in the global dictionary and verify that all
    # names are in the names_out set
    for donor in mr.donors:
        assert donor in names_out
示例#5
0
 def test_list_donors(self):
     real = list_donors(dons)
     expected = [item for item in dons]
     self.assertEqual(real, expected)
示例#6
0
 def test_list_donors_exception(self, test_input, expected):
     with raises(expected) as info:
         mailroom.list_donors(test_input)
示例#7
0
def test_list_donors():
    given = {'top': [1, 2], 'bottom': [3, 4]}
    expected = 'top\nbottom\n'
    assert mailroom4.list_donors(given) == expected
示例#8
0
def test_list_donors():
    donor_list = mailroom.list_donors()
    assert 'Jeff Bezos' in donor_list
示例#9
0
def test_3():
    assert list_donors(test_dict) == ['test_name', 'test_name2']
示例#10
0
def test_list_donors():
    donor_list = [donor for donor in mailroom4.donor_db.keys()]
    assert mailroom4.list_donors() == print(donor_list)
示例#11
0
def test_list_donors():
    listing = mailroom.list_donors()
    assert "Charlie Brown" in listing
    assert "Barack Omama" not in listing
示例#12
0
def test_list_donors():  # checks list of donors shown
    expected_list = print("Name1\nName2")
    assert mail.list_donors(dict) == expected_list