Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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"'