diff options
| author | Dylan Verheul <dylan@zostera.nl> | 2016-11-30 12:32:47 +0100 |
|---|---|---|
| committer | Dylan Verheul <dylan@zostera.nl> | 2016-11-30 12:32:47 +0100 |
| commit | 91d3299280a57a6780c446c21a506f6259552c0a (patch) | |
| tree | f77b194b7729fb14598f11a3653aac14fbc22059 /test_tablib.py | |
| parent | f59abe84be6197e8675bc8d04e65ee7b820f4d52 (diff) | |
| download | tablib-91d3299280a57a6780c446c21a506f6259552c0a.tar.gz | |
Fix date and datetime export to JSON in Python versions with a json package
Python without a json package will use omnijson and fail on date and datetime objects.
Added unit tests.
Diffstat (limited to 'test_tablib.py')
| -rwxr-xr-x | test_tablib.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test_tablib.py b/test_tablib.py index be41ee7..6aa4be4 100755 --- a/test_tablib.py +++ b/test_tablib.py @@ -6,6 +6,9 @@ import json import unittest import sys import os + +import datetime + import tablib from tablib.compat import markup, unicode, is_py3 from tablib.core import Row @@ -381,6 +384,26 @@ class TablibTestCase(unittest.TestCase): data.html data.latex + def test_datetime_append(self): + """Passes in a single datetime and a single date and exports.""" + + new_row = ( + datetime.datetime.now(), + datetime.datetime.today(), + ) + + data.append(new_row) + + data.json + data.yaml + data.csv + data.tsv + data.xls + data.xlsx + data.ods + data.html + data.latex + def test_book_export_no_exceptions(self): """Test that various exports don't error out.""" |
