self = <swh.storage.tests.test_postgresql.TestStorage object at 0x7f7a0df8cc88>
swh_storage = <swh.storage.postgresql.storage.Storage object at 0x7f7a0ddf3710>
sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7f7a0ddf3da0>
def test_content_metadata_add(self, swh_storage, sample_data):
content = sample_data.content
fetcher = sample_data.metadata_fetcher
authority = sample_data.metadata_authority
content_metadata = sample_data.content_metadata[:2]
swh_storage.metadata_fetcher_add([fetcher])
swh_storage.metadata_authority_add([authority])
swh_storage.raw_extrinsic_metadata_add(content_metadata)
result = swh_storage.raw_extrinsic_metadata_get(
> content.swhid().to_extended(), authority
)
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/storage_tests.py:4067:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/core/db/common.py:62: in _meth
return meth(self, *args, db=db, cur=cur, **kwargs)
.tox/py3/lib/python3.7/site-packages/swh/storage/postgresql/storage.py:1465: in raw_extrinsic_metadata_get
results.append(converters.db_to_raw_extrinsic_metadata(row))
.tox/py3/lib/python3.7/site-packages/swh/storage/postgresql/converters.py:326: in db_to_raw_extrinsic_metadata
directory=map_optional(CoreSWHID.from_string, row["directory"]),
<attrs generated init swh.model.model.RawExtrinsicMetadata>:18: in __init__
__attr_validator_target(self, __attr_target, self.target)
.tox/py3/lib/python3.7/site-packages/attrs_strict/_type_validation.py:105: in _validator
_validate_elements(attribute, field, attribute.type)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attribute = Attribute(name='target', default=NOTHING, validator=<function type_validator.<locals>._validator at 0x7f7c538318c8>, r...xy({}), type=<class 'swh.model.swhids.ExtendedSWHID'>, converter=None, kw_only=False, inherited=False, on_setattr=None)
value = 'swh:1:cnt:d81cc0710eb6cf9efd5b920a8453e1e07157b6cd'
expected_type = <class 'swh.model.swhids.ExtendedSWHID'>
def _validate_elements(attribute, value, expected_type):
if expected_type is None:
return
base_type = _get_base_type(expected_type)
if base_type == typing.Any:
return
if isinstance(base_type, (str, ForwardRef)):
# These base_types happen when you have string annotations and cannot
# be used in isinstance.
raise _StringAnnotationError()
elif base_type == Literal or base_type == type(Literal): # type: ignore
_handle_literal(attribute, value, expected_type)
elif base_type == typing.Union: # type: ignore
_handle_union(attribute, value, expected_type)
elif not isinstance(value, base_type):
> raise AttributeTypeError(value, attribute)
E attrs_strict._error.AttributeTypeError: target must be <class 'swh.model.swhids.ExtendedSWHID'> (got swh:1:cnt:d81cc0710eb6cf9efd5b920a8453e1e07157b6cd that is a <class 'str'>)
.tox/py3/lib/python3.7/site-packages/attrs_strict/_type_validation.py:131: AttributeTypeError
TEST RESULT
TEST RESULT
- Run At
- Oct 7 2021, 11:27 AM