mirror of
https://github.com/kennethreitz/tablib.git
synced 2026-06-05 06:56:13 +00:00
Fixes #274 - Fix Databook.load() params ordering
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
# History
|
# History
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
- Fixed `DataBook().load` parameter ordering (first stream, then format).
|
||||||
|
|
||||||
## 0.11.5 (2017-06-13)
|
## 0.11.5 (2017-06-13)
|
||||||
|
|
||||||
- Use `yaml.safe_load` for importing yaml.
|
- Use `yaml.safe_load` for importing yaml.
|
||||||
|
|||||||
+1
-1
@@ -1089,7 +1089,7 @@ class Databook(object):
|
|||||||
"""The number of the :class:`Dataset` objects within :class:`Databook`."""
|
"""The number of the :class:`Dataset` objects within :class:`Databook`."""
|
||||||
return len(self._datasets)
|
return len(self._datasets)
|
||||||
|
|
||||||
def load(self, format, in_stream, **kwargs):
|
def load(self, in_stream, format, **kwargs):
|
||||||
"""
|
"""
|
||||||
Import `in_stream` to the :class:`Databook` object using the `format`.
|
Import `in_stream` to the :class:`Databook` object using the `format`.
|
||||||
|
|
||||||
|
|||||||
@@ -806,6 +806,9 @@ class JSONTests(BaseTestCase):
|
|||||||
book.json = _json
|
book.json = _json
|
||||||
|
|
||||||
self.assertEqual(json.loads(_json), json.loads(book.json))
|
self.assertEqual(json.loads(_json), json.loads(book.json))
|
||||||
|
# Same with the load interface
|
||||||
|
book2 = tablib.Databook().load(_json, None)
|
||||||
|
self.assertEqual(json.loads(book.json), json.loads(book2.json))
|
||||||
|
|
||||||
def test_json_import_set(self):
|
def test_json_import_set(self):
|
||||||
"""Generate and import JSON set serialization."""
|
"""Generate and import JSON set serialization."""
|
||||||
@@ -862,6 +865,9 @@ class YAMLTests(BaseTestCase):
|
|||||||
book.yaml = _yaml
|
book.yaml = _yaml
|
||||||
|
|
||||||
self.assertEqual(_yaml, book.yaml)
|
self.assertEqual(_yaml, book.yaml)
|
||||||
|
# Same with the load interface
|
||||||
|
book2 = tablib.Databook().load(_yaml, None)
|
||||||
|
self.assertEqual(_yaml, book2.yaml)
|
||||||
|
|
||||||
def test_yaml_import_set(self):
|
def test_yaml_import_set(self):
|
||||||
"""Generate and import YAML set serialization."""
|
"""Generate and import YAML set serialization."""
|
||||||
|
|||||||
Reference in New Issue
Block a user