~/dev/git-repos/tablib$ PAGER=cat git log -1 --oneline
e8c923d Merge pull request #58 from jqb/develop
~/dev/git-repos/tablib$ .tox/py27/bin/pip freeze
PyYAML==3.10
distribute==0.6.24
omnijson==0.1.2
py==1.4.7
pytest==2.2.3
tablib==0.9.11
wsgiref==0.1.2
xlrd==0.7.7
~/dev/git-repos/tablib$ .tox/py27/bin/py.test test_tablib.py
===================================== test session starts ======================================
platform darwin -- Python 2.7.3 -- pytest-2.2.3
collected 44 items
test_tablib.py ..........................................F.
====================================== FAILURES ======================================
_____________________________ TablibTestCase.test_yaml_import_book _____________________________
self = <test_tablib.TablibTestCase testMethod=test_yaml_import_book>
def test_yaml_import_book(self):
"""Generate and import YAML book serialization."""
data.append(self.john)
data.append(self.george)
data.headers = self.headers
book.add_sheet(data)
_yaml = book.yaml
> book.yaml = _yaml
test_tablib.py:386:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
dbook = <databook object>
in_stream = '- !!python/object/apply:collections.OrderedDict\n - - - data\n - - !!python/object/apply:collections.OrderedDic... - - [first_name, George]\n - [last_name, Washington]\n - [gpa, 67]\n - [title, null]\n'
def import_book(dbook, in_stream):
"""Returns databook from YAML stream."""
dbook.wipe()
> for sheet in yaml.safe_load(in_stream):
tablib/formats/_yaml.py:49:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
stream = '- !!python/object/apply:collections.OrderedDict\n - - - data\n - - !!python/object/apply:collections.OrderedDic... - - [first_name, George]\n - [last_name, Washington]\n - [gpa, 67]\n - [title, null]\n'
def safe_load(stream):
"""
Parse the first YAML document in a stream
and produce the corresponding Python object.
Resolve only basic YAML tags.
"""
> return load(stream, SafeLoader)
def safe_load_all(stream):
.tox/py27/lib/python2.7/site-packages/yaml/__init__.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
stream = '- !!python/object/apply:collections.OrderedDict\n - - - data\n - - !!python/object/apply:collections.OrderedDic... - - [first_name, George]\n - [last_name, Washington]\n - [gpa, 67]\n - [title, null]\n'
Loader = <class 'yaml.loader.SafeLoader'>
def load(stream, Loader=Loader):
"""
Parse the first YAML document in a stream
and produce the corresponding Python object.
"""
loader = Loader(stream)
try:
> return loader.get_single_data()
finally:
.tox/py27/lib/python2.7/site-packages/yaml/__init__.py:71:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <yaml.loader.SafeLoader object at 0x101e9ab90>
def get_single_data(self):
# Ensure that the stream contains a single document and construct it.
node = self.get_single_node()
if node is not None:
> return self.construct_document(node)
.tox/py27/lib/python2.7/site-packages/yaml/constructor.py:39:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <yaml.loader.SafeLoader object at 0x101e9ab90>
node = SequenceNode(tag=u'tag:yaml.org,2002:seq', value=[SequenceNode(tag=u'tag:yaml....lue=u'title'), ScalarNode(tag=u'tag:yaml.org,2002:null', value=u'null')])])])])
def construct_document(self, node):
data = self.construct_object(node)
while self.state_generators:
state_generators = self.state_generators
self.state_generators = []
for generator in state_generators:
> for dummy in generator:
.tox/py27/lib/python2.7/site-packages/yaml/constructor.py:48:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <yaml.loader.SafeLoader object at 0x101e9ab90>
node = SequenceNode(tag=u'tag:yaml.org,2002:seq', value=[SequenceNode(tag=u'tag:yaml....lue=u'title'), ScalarNode(tag=u'tag:yaml.org,2002:null', value=u'null')])])])])
def construct_yaml_seq(self, node):
data = []
yield data
> data.extend(self.construct_sequence(node))
.tox/py27/lib/python2.7/site-packages/yaml/constructor.py:393:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <yaml.loader.SafeLoader object at 0x101e9ab90>
node = SequenceNode(tag=u'tag:yaml.org,2002:seq', value=[SequenceNode(tag=u'tag:yaml....lue=u'title'), ScalarNode(tag=u'tag:yaml.org,2002:null', value=u'null')])])])])
deep = False
def construct_sequence(self, node, deep=False):
if not isinstance(node, SequenceNode):
raise ConstructorError(None, None,
"expected a sequence node, but found %s" % node.id,
node.start_mark)
return [self.construct_object(child, deep=deep)
> for child in node.value]
.tox/py27/lib/python2.7/site-packages/yaml/constructor.py:118:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <yaml.loader.SafeLoader object at 0x101e9ab90>
node = SequenceNode(tag=u'tag:yaml.org,2002:python/object/apply:collections.OrderedDi...value=u'title'), ScalarNode(tag=u'tag:yaml.org,2002:null', value=u'null')])])])
deep = False
def construct_object(self, node, deep=False):
if node in self.constructed_objects:
return self.constructed_objects[node]
if deep:
old_deep = self.deep_construct
self.deep_construct = True
if node in self.recursive_objects:
raise ConstructorError(None, None,
"found unconstructable recursive node", node.start_mark)
self.recursive_objects[node] = None
constructor = None
tag_suffix = None
if node.tag in self.yaml_constructors:
constructor = self.yaml_constructors[node.tag]
else:
for tag_prefix in self.yaml_multi_constructors:
if node.tag.startswith(tag_prefix):
tag_suffix = node.tag[len(tag_prefix):]
constructor = self.yaml_multi_constructors[tag_prefix]
break
else:
if None in self.yaml_multi_constructors:
tag_suffix = node.tag
constructor = self.yaml_multi_constructors[None]
elif None in self.yaml_constructors:
constructor = self.yaml_constructors[None]
elif isinstance(node, ScalarNode):
constructor = self.__class__.construct_scalar
elif isinstance(node, SequenceNode):
constructor = self.__class__.construct_sequence
elif isinstance(node, MappingNode):
constructor = self.__class__.construct_mapping
if tag_suffix is None:
> data = constructor(self, node)
.tox/py27/lib/python2.7/site-packages/yaml/constructor.py:88:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <yaml.loader.SafeLoader object at 0x101e9ab90>
node = SequenceNode(tag=u'tag:yaml.org,2002:python/object/apply:collections.OrderedDi...value=u'title'), ScalarNode(tag=u'tag:yaml.org,2002:null', value=u'null')])])])
def construct_undefined(self, node):
raise ConstructorError(None, None,
"could not determine a constructor for the tag %r" % node.tag.encode('utf-8'),
> node.start_mark)
E ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:python/object/apply:collections.OrderedDict'
E in "<string>", line 1, column 3:
E - !!python/object/apply:collection ...
E ^
.tox/py27/lib/python2.7/site-packages/yaml/constructor.py:414: ConstructorError
============================= 1 failed, 43 passed in 0.41 seconds ==============================