roskakori / cutplace

validate data stored in CSV, PRN, ODS or Excel files
http://cutplace.readthedocs.org/
GNU Lesser General Public License v3.0
18 stars 20 forks source link

Add support for delimited data without quote character and/or escape character #83

Open roskakori opened 9 years ago

roskakori commented 9 years ago

Goal: delimited data can have no quote character

Example CID-fragment:

D,format,delimited
D,quote character,none

Internally, the quote/escape character should be None similar to line_separator.

Consequently DataFormat.validate() must ensure that without quote_character and escape character the decimal_separator and thousands separator differ from item and line delimiter. Proposed test case for this:

def test_fails_on_no_quote_and_escapte_character_with_same_item_delimiter_and_thousands_separator(self):
     delimited_format = data.DataFormat(data.FORMAT_DELIMITED)
     delimited_format.set_property(data.KEY_ESCAPE_CHARACTER, 'none')
     delimited_format.set_property(data.KEY_ITEM_DELIMITER, '.')
     delimited_format.set_property(data.KEY_QUOTE_CHARACTER, 'none')
     delimited_format.set_property(data.KEY_THOUSANDS_SEPARATOR, '.')
         self.assertRaises(errors.InterfaceError, delimited_format.validate)