Fix: Circular reference detected error (#332)

* Rename function name

* Add uuid handler on json dumps

* Add myself to authors
This commit is contained in:
Bruno Soares
2018-09-12 15:49:46 -03:00
committed by Iuri de Silvio
parent 38486231cc
commit 3d5943a8a4
3 changed files with 23 additions and 5 deletions
+17
View File
@@ -6,6 +6,7 @@ import doctest
import json
import unittest
import sys
from uuid import uuid4
import datetime
@@ -226,6 +227,22 @@ class TablibTestCase(unittest.TestCase):
# Delete from invalid index
self.assertRaises(IndexError, self.founders.__delitem__, 3)
def test_json_export(self):
"""Verify exporting dataset object as JSON"""
address_id = uuid4()
headers = self.headers + ('address_id',)
founders = tablib.Dataset(headers=headers, title='Founders')
founders.append(('John', 'Adams', 90, address_id))
founders_json = founders.export('json')
expected_json = (
'[{"first_name": "John", "last_name": "Adams", "gpa": 90, '
'"address_id": "%s"}]' % str(address_id)
)
self.assertEqual(founders_json, expected_json)
def test_csv_export(self):
"""Verify exporting dataset object as CSV."""