Fix #24, add support of spaces in CSV files.

This commit is contained in:
Igor Davydenko
2011-03-01 19:36:19 +02:00
parent 52e9d44739
commit 2f331cee8e
2 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ def import_set(dset, in_stream, headers=True):
dset.wipe()
rows = csv.reader(in_stream.split())
rows = csv.reader(in_stream.splitlines())
for i, row in enumerate(rows):
if (i == 0) and (headers):
+13
View File
@@ -295,6 +295,19 @@ class TablibTestCase(unittest.TestCase):
self.assertEqual(_csv, data.csv)
def test_csv_import_set_with_spaces(self):
"""Generate and import CSV set serialization when row values have
spaces."""
data.append(('Bill Gates', 'Microsoft'))
data.append(('Steve Jobs', 'Apple'))
data.headers = ('Name', 'Company')
_csv = data.csv
data.csv = _csv
self.assertEqual(_csv, data.csv)
def test_tsv_import_set(self):
"""Generate and import TSV set serialization."""
data.append(self.john)