gh-113785: csv: fields starting with escapechar are not quoted (GH-122110)

This commit is contained in:
Mikołaj Kuranowski 2024-07-25 09:04:47 +02:00 committed by GitHub
parent 9b4fe9b718
commit a3327dbfd4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 1 deletions

View file

@ -454,6 +454,10 @@ class Test_Csv(unittest.TestCase):
quoting=csv.QUOTE_STRINGS)
self._read_test(['1,@,3,@,5'], [['1', ',3,', '5']], quotechar='@')
self._read_test(['1,\0,3,\0,5'], [['1', ',3,', '5']], quotechar='\0')
self._read_test(['1\\.5,\\.5,.5'], [[1.5, 0.5, 0.5]],
quoting=csv.QUOTE_NONNUMERIC, escapechar='\\')
self._read_test(['1\\.5,\\.5,"\\.5"'], [[1.5, 0.5, ".5"]],
quoting=csv.QUOTE_STRINGS, escapechar='\\')
def test_read_skipinitialspace(self):
self._read_test(['no space, space, spaces,\ttab'],