How to use the mailmerge.__main__ function in mailmerge

To help you get started, we’ve selected a few mailmerge examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github awdeorio / mailmerge / tests / test_helpers.py View on Github external
def test_enumerate_limit_no_limit():
    """Verify limit=-1 results in no early termination."""
    iterations = 0
    for _, _ in mailmerge.__main__.enumerate_limit(["a", "b", "c"], -1):
        iterations += 1
    assert iterations == 3
github awdeorio / mailmerge / tests / test_helpers.py View on Github external
def test_csv_quotes_commas(tmpdir):
    """CSV with quotes and commas.

    Note that quotes are escaped with double quotes, not backslash.
    https://docs.python.org/3.7/library/csv.html#csv.Dialect.doublequote
    """
    database_path = Path(tmpdir/"database.csv")
    database_path.write_text(textwrap.dedent(u'''\
        email,message
        one@test.com,"Hello, ""world"""
    '''))
    row = next(mailmerge.__main__.read_csv_database(database_path))
    assert row["email"] == u"one@test.com"
    assert row["message"] == 'Hello, "world"'