Bug description
Lib/test/test_csv.py already covers the basic writer behavior for csv.QUOTE_STRINGS and csv.QUOTE_NOTNULL, but it does not explicitly exercise a couple of edge cases for these newer quoting modes:
quotechar=None should be rejected when quoting is enabled for QUOTE_STRINGS and QUOTE_NOTNULL, just like QUOTE_ALL.
- quoted fields using these modes should continue to handle embedded quote characters and escape characters correctly, including the
doublequote=False path.
These are small conformance checks for behavior already implemented in _csv, and they help alternative Python implementations catch regressions around the newer quote styles.
Reproducer / expected behavior
import csv
from io import StringIO
for quoting in (csv.QUOTE_STRINGS, csv.QUOTE_NOTNULL):
try:
csv.writer(StringIO(), quoting=quoting, quotechar=None)
except TypeError:
pass
else:
raise AssertionError("quotechar=None should be rejected")
csv.writer should also preserve the existing escaping behavior for QUOTE_STRINGS and QUOTE_NOTNULL when escapechar is configured and doublequote is toggled.
CPython versions tested on
Operating systems tested on
Linked PRs
Bug description
Lib/test/test_csv.pyalready covers the basic writer behavior forcsv.QUOTE_STRINGSandcsv.QUOTE_NOTNULL, but it does not explicitly exercise a couple of edge cases for these newer quoting modes:quotechar=Noneshould be rejected when quoting is enabled forQUOTE_STRINGSandQUOTE_NOTNULL, just likeQUOTE_ALL.doublequote=Falsepath.These are small conformance checks for behavior already implemented in
_csv, and they help alternative Python implementations catch regressions around the newer quote styles.Reproducer / expected behavior
csv.writershould also preserve the existing escaping behavior forQUOTE_STRINGSandQUOTE_NOTNULLwhenescapecharis configured anddoublequoteis toggled.CPython versions tested on
Operating systems tested on
Linked PRs