def test_metadata_from_old_dict():
common_fields = {
"authority": {"type": "forge", "url": "https://forge.softwareheritage.org"},
"fetcher": {
"name": "test-fetcher",
"version": "0.0.1",
},
"discovery_date": _common_metadata_fields["discovery_date"],
"format": "json",
"metadata": b'{"origin": "https://example.com", "lines": "42"}',
}
m = RawExtrinsicMetadata(
target=_origin_swhid,
> **common_fields,
)
.tox/py3-full/lib/python3.7/site-packages/swh/model/tests/test_model.py:1445:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
<attrs generated init swh.model.model.RawExtrinsicMetadata>:18: in __init__
__attr_validator_authority(self, __attr_authority, self.authority)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
instance = RawExtrinsicMetadata(target=ExtendedSWHID.from_string('swh:1:ori:94a9ed024d3859793618152ea559a168bbcbb5e2'), discovery..., origin=None, visit=None, snapshot=None, release=None, revision=None, path=None, directory=None, id=hash_to_bytes(''))
attribute = Attribute(name='authority', default=NOTHING, validator=<function type_validator.<locals>.validator at 0x7f63e3922620>,...{}), type=<class 'swh.model.model.MetadataAuthority'>, converter=None, kw_only=False, inherited=False, on_setattr=None)
value = {'type': 'forge', 'url': 'https://forge.softwareheritage.org'}
def validator(instance, attribute, value):
if not _check_type(attribute.type, value):
> raise AttributeTypeError(value, attribute)
E attrs_strict._error.AttributeTypeError: authority must be <class 'swh.model.model.MetadataAuthority'> (got {'type': 'forge', 'url': 'https://forge.softwareheritage.org'} that is a <class 'dict'>)
.tox/py3-full/lib/python3.7/site-packages/swh/model/model.py:159: AttributeTypeError
TEST RESULT
TEST RESULT
- Run At
- Aug 30 2022, 5:56 PM