[Csv] [Python-Dev] These csv test cases seem incorrect to me...
mal at egenix.com
Wed Mar 14 12:11:50 CET 2007
On 2007-03-12 03:01, skip at pobox.com wrote:
> I decided it would be worthwhile to have a csv module written in Python (no
> C underpinnings) for a number of reasons:
> * It will probably be easier to add Unicode support to a Python version
> * More people will be able to read/grok/modify/fix bugs in a Python
> implementation than in the current mixed Python/C implementation.
> * With alternative implementations of Python available (PyPy,
> IronPython, Jython) it makes sense to have a Python version they can
Lots of good reasons :-)
I've written a Python-only Unicode aware CSV module for a client (mostly
because CSV data tends to be quirky and I needed a quick way of dealing
with corner cases). Perhaps I can get them to donate it to the PSF...
> I'm far from having anything which will pass the current test suite, but in
> diagnosing some of my current failures I noticed a couple test cases which
> seem wrong. In the TestDialectExcel class I see these two questionable
> def test_quotes_and_more(self):
> self.readerAssertEqual('"a"b', [['ab']])
> def test_quote_and_quote(self):
> self.readerAssertEqual('"a" "b"', [['a "b"']])
> It seems to me that if a field starts with a quote it *has* to be a quoted
> field. Any quotes appearing within a quoted field have to be escaped and
> the field has to end with a quote. Both of these test cases fail on or the
> other assumption. If they are indeed both correct and I'm just looking at
> things crosseyed I think they at least deserve comments explaining why they
> are correct.
> Both test cases date from the first checkin. I performed the checkin
> because of the group developing the module I believe I was the only one with
> checkin privileges at the time, not because I wrote the test cases.
> Any ideas about why these test cases are in there? I can't imagine Excel
> generating either one.
My recommendation: Let the module do whatever Excel does with such data.
Professional Python Services directly from the Source (#1, Mar 14 2007)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::
More information about the Csv