def test_13():
    # Check content of letter created in test_11
    global letter
    with letter.open("r") as fileio:
        assert fileio.read() == mailroom.format_letter('Abraham Lincoln')
def test_1():
    # Validate that the letter is returned
    result = mailroom.format_letter('James K. Polk')
    for segment in mailroom.letter_template.split('{'):
        assert segment.split('}')[-1] in result
def test_3():
    # Invalid donor should result in False retval
    assert mailroom.format_letter('Abraham Lincoln') is False
def test_8():
    # Abraham Lincoln should be a valid key now thanks to test 5, so we should get a valid letter
    result = mailroom.format_letter('Abraham Lincoln')
    for segment in mailroom.letter_template.split('{'):
        assert segment.split('}')[-1] in result
def test_2():
    # Validate presence of extra whitespace
    result = mailroom.format_letter('Martin van Buren', True)
    for segment in mailroom.letter_whitespace.format(mailroom.letter_template).split('{}'):
        assert segment.split('}')[-1] in result