def test_db_to_raw_extrinsic_metadata_raw_target():
row = {
"raw_extrinsic_metadata.target": "https://example.com/origin",
"metadata_authority.type": "forge",
"metadata_authority.url": "https://example.com",
"metadata_fetcher.name": "swh.lister",
"metadata_fetcher.version": "1.0.0",
"discovery_date": datetime.datetime(
2021, 1, 1, 0, 0, 0, tzinfo=datetime.timezone.utc
),
"format": "text/plain",
"raw_extrinsic_metadata.metadata": b"metadata",
"origin": None,
"visit": None,
"snapshot": None,
"release": None,
"revision": None,
"path": None,
"directory": None,
}
with pytest.deprecated_call():
> computed_rem = converters.db_to_raw_extrinsic_metadata(row)
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_postgresql_converters.py:196:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/storage/postgresql/converters.py:309: in db_to_raw_extrinsic_metadata
target=ExtendedSWHID.from_string(target),
.tox/py3/lib/python3.7/site-packages/swh/model/swhids.py:137: in from_string
parts = _parse_swhid(s)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
swhid = ExtendedSWHID(namespace='swh', scheme_version=1, object_id=b'Zt9\xb0\xb9:]#\x0bjg\xb8\xe7\xe0\xf7\xdc<\x9flp', object_type=<ExtendedObjectType.ORIGIN: 'ori'>)
def _parse_swhid(swhid: str) -> Dict[str, Any]:
"""Parse a Software Heritage identifier (SWHID) from string (see:
:ref:`persistent-identifiers`.)
This is for internal use; use :meth:`CoreSWHID.from_string`,
:meth:`QualifiedSWHID.from_string`, or :meth:`ExtendedSWHID.from_string` instead,
as they perform validation and build a dataclass.
Args:
swhid (str): A persistent identifier
Raises:
swh.model.exceptions.ValidationError: if passed string is not a valid SWHID
"""
> m = SWHID_RE.fullmatch(swhid)
E TypeError: expected string or bytes-like object
.tox/py3/lib/python3.7/site-packages/swh/model/swhids.py:435: TypeError
TEST RESULT
TEST RESULT
- Run At
- Oct 7 2021, 11:57 AM