[issue10515] csv sniffer does not recognize quotes at the end of line

2010-12-14 Thread Martin Budaj

Martin Budaj m.bu...@gmail.com added the comment:

 What do you mean by there is a test for this case in csv.py?  

I meant test in regex on line 217 in python 2.7 and the following code (line 
258ff):

# there is *no* delimiter, it's a single column of quoted data
delim = ''
skipinitialspace = 0

However, it is intended to detect just lines starting and ending with quotes.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10515
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10515] csv sniffer does not recognize quotes at the end of line

2010-12-04 Thread Martin Budaj

Martin Budaj m.bu...@gmail.com added the comment:

I'm not sure about what the intended behavior for testAl should be, however I 
think that the file should be recognized as having one column of data and no 
delimiter (there is a test for this case in csv.py) and not raise an exception.

I attach patch for test_csv.py tests. It includes two more tests which 
currently fail (both contain \r\n as a newline)

--
Added file: http://bugs.python.org/file19944/test_csv.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10515
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10515] csv sniffer does not recognize quotes at the end of line

2010-11-24 Thread Martin Budaj

Martin Budaj m.bu...@gmail.com added the comment:

Units test and two patches for 2.7 are included.

p1.patch fixes testEnd case reported yesterday

After running unittest it seems that also other case is broken (testAl -- if 
there is just one data item on the line, enclosed in quotes). Patch p2 fixes 
it, but should be checked for side-effects.

--
Added file: http://bugs.python.org/file19799/fix.tar.gz

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10515
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10515] csv sniffer does not recognize quotes at the end of line

2010-11-23 Thread Martin Budaj

New submission from Martin Budaj m.bu...@gmail.com:

The method Sniffer._guess_quote_and_delimiter() in the module csv.py contains a 
bug in a regexp which checks for quotes around the last item of the line 
(example: a,b,c,d\n).

the pattern
'(?Pdelim[^\w\n\'])(?Pspace ?)(?Pquote[\']).*?(?P=quote)(?:$|\n)'
used in the regex should be changed to
'(?Pdelim[^\w\n\'])(?Pspace ?)(?Pquote[\']).*?(?P=quote)(?:$|\n)'

file csv.py: line 212 in python 2.6, line 216 in 2.7, line 207 in 3.1

--
components: Library (Lib)
messages: 17
nosy: Martin.Budaj
priority: normal
severity: normal
status: open
title: csv sniffer does not recognize quotes at the end of line
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10515
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com