diff options
| author | Claude Paroz <claude@2xlibre.net> | 2019-10-03 23:44:24 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2019-10-04 19:45:42 +0200 |
| commit | 5fde5259d9adcfc47db93110d2dac6b08f31e24f (patch) | |
| tree | 6bae1e205c966871e54586b22f19857b49064644 /test_tablib.py | |
| parent | 591e8f74489bcd2b60e1dd39154f3078adbec827 (diff) | |
| download | tablib-5fde5259d9adcfc47db93110d2dac6b08f31e24f.tar.gz | |
Fixes #314 - Delegate type coercion to openpyxl
Thanks Cristiano Lopes for the initial patch.
Diffstat (limited to 'test_tablib.py')
| -rwxr-xr-x | test_tablib.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test_tablib.py b/test_tablib.py index 758ac91..bff3147 100755 --- a/test_tablib.py +++ b/test_tablib.py @@ -782,6 +782,25 @@ class TSVTests(BaseTestCase): self.assertEqual(tsv, self.founders.tsv) +class XLSXTests(BaseTestCase): + def test_xlsx_import_set(self): + data.append(('string', 42, 21.55)) + data.headers = ('string', 'integer', 'float') + _xlsx = data.xlsx + data.xlsx = _xlsx + self.assertEqual(data.dict[0]['string'], 'string') + self.assertEqual(data.dict[0]['integer'], 42) + self.assertEqual(data.dict[0]['float'], 21.55) + + def test_xlsx_wrong_char(self): + """Bad characters are not silently ignored. We let the exception bubble up.""" + from openpyxl.utils.exceptions import IllegalCharacterError + + with self.assertRaises(IllegalCharacterError): + data.append(('string', b'\x0cf')) + data.xlsx + + class JSONTests(BaseTestCase): def test_json_format_detect(self): """Test JSON format detection.""" |
