summaryrefslogtreecommitdiff
path: root/test_tablib.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2019-10-04 20:32:01 +0200
committerClaude Paroz <claude@2xlibre.net>2019-10-04 20:46:31 +0200
commit91062672b5406972da75bdcf02ad8373fff96377 (patch)
tree2ced8643acabcb9238d9c47d45f4ceea86439d2d /test_tablib.py
parent34334e72a12c28425aff9162da13c3300bb80e18 (diff)
downloadtablib-91062672b5406972da75bdcf02ad8373fff96377.tar.gz
Fixed #373 - Properly detect xlsx format
Diffstat (limited to 'test_tablib.py')
-rwxr-xr-xtest_tablib.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/test_tablib.py b/test_tablib.py
index e4f1543..012f89d 100755
--- a/test_tablib.py
+++ b/test_tablib.py
@@ -13,7 +13,7 @@ from uuid import uuid4
from MarkupPy import markup
import tablib
from tablib.compat import unicode, is_py3
-from tablib.core import Row
+from tablib.core import Row, detect_format
from tablib.formats import _csv as csv_module
@@ -783,6 +783,16 @@ class TSVTests(BaseTestCase):
class XLSXTests(BaseTestCase):
+ def test_xlsx_format_detect(self):
+ """Test the XLSX format detection."""
+ in_stream = self.founders.xlsx
+ self.assertEqual(detect_format(in_stream), 'xlsx')
+
+ def test_xls_format_detect(self):
+ """Test the XLS format detection."""
+ in_stream = self.founders.xls
+ self.assertEqual(detect_format(in_stream), 'xls')
+
def test_xlsx_import_set(self):
date_time = datetime.datetime(2019, 10, 4, 12, 30, 8)
data.append(('string', 42, 21.55, date_time))