self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7f1d181e8320>
swh_storage = <swh.storage.validate.ValidatingProxyStorage object at 0x7f1d181e81d0>
def test_revision_add_name_clash(self, swh_storage):
revision1 = data.revision
revision2 = data.revision2
revision1["author"] = {
"fullname": b"John Doe <john.doe@example.com>",
"name": b"John Doe",
"email": b"john.doe@example.com",
}
revision2["author"] = {
"fullname": b"John Doe <john.doe@example.com>",
"name": b"John Doe ",
"email": b"john.doe@example.com ",
}
> actual_result = swh_storage.revision_add([revision1, revision2])
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:1024:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/storage/validate.py:104: in revision_add
[dict_converter(Revision, r) for r in revisions]
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:433: in revision_add
revobject = revision_to_db(revision)
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/converters.py:38: in revision_to_db
db_revision["metadata"] = json.dumps(db_revision["metadata"])
/usr/lib/python3.7/json/__init__.py:231: in dumps
return _default_encoder.encode(obj)
/usr/lib/python3.7/json/encoder.py:199: in encode
chunks = self.iterencode(o, _one_shot=True)
/usr/lib/python3.7/json/encoder.py:257: in iterencode
return _iterencode(o, 0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <json.encoder.JSONEncoder object at 0x7f1d7fd98cc0>
o = <swh.model.collections.ImmutableDict object at 0x7f1d544d3a90>
def default(self, o):
"""Implement this method in a subclass such that it returns
a serializable object for ``o``, or calls the base implementation
(to raise a ``TypeError``).
For example, to support arbitrary iterators, you could
implement default like this::
def default(self, o):
try:
iterable = iter(o)
except TypeError:
pass
else:
return list(iterable)
# Let the base class default method raise the TypeError
return JSONEncoder.default(self, o)
"""
> raise TypeError(f'Object of type {o.__class__.__name__} '
f'is not JSON serializable')
E TypeError: Object of type ImmutableDict is not JSON serializable
/usr/lib/python3.7/json/encoder.py:179: TypeError
TEST RESULT
TEST RESULT
- Run At
- Jul 9 2020, 10:49 AM