diff options
author | Kenneth Reitz <me@kennethreitz.com> | 2011-03-01 17:06:15 -0500 |
---|---|---|
committer | Kenneth Reitz <me@kennethreitz.com> | 2011-03-01 17:06:15 -0500 |
commit | 03914323c2077f61a40e4dd1a9a87de4214c5b2e (patch) | |
tree | 9e326e7a3520883c8a6a56a5bdb11cc429252a3f | |
parent | e1734f2315bdb87f894911b1e031de39e7297bb6 (diff) | |
parent | 2f331cee8ece577b54644efb7e2219ed61d75380 (diff) | |
download | tablib-feature/xls-width.tar.gz |
Merge https://github.com/playpauseandstop/tablib into developfeature/xls-width
-rw-r--r-- | tablib/formats/_csv.py | 2 | ||||
-rwxr-xr-x | test_tablib.py | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/tablib/formats/_csv.py b/tablib/formats/_csv.py index 2c74a1c..b71755b 100644 --- a/tablib/formats/_csv.py +++ b/tablib/formats/_csv.py @@ -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): diff --git a/test_tablib.py b/test_tablib.py index e4a4d11..4079809 100755 --- a/test_tablib.py +++ b/test_tablib.py @@ -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) |