api_client = <rest_framework.test.APIClient object at 0x7f388263bb38>
def test_api_raw_not_found(api_client):
> unknown_swhid = random_swhid()
.tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_raw.py:18:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/web/tests/data.py:89: in random_swhid
object_id=random_sha1(),
<attrs generated init swh.model.swhids.CoreSWHID>:11: in __init__
__attr_validator_object_id(self, __attr_object_id, self.object_id)
.tox/py3/lib/python3.7/site-packages/attr/_make.py:3096: in __call__
v(inst, attr, value)
.tox/py3/lib/python3.7/site-packages/attrs_strict/_type_validation.py:103: in _validator
_validate_elements(attribute, field, attribute.type)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attribute = Attribute(name='object_id', default=NOTHING, validator=_AndValidator(_validators=(<function type_validator.<locals>._v...t=True, metadata=mappingproxy({}), type=<class 'bytes'>, converter=None, kw_only=True, inherited=True, on_setattr=None)
value = '4dbcd76a0da0f04da728d52eb407de179e3d848c'
expected_type = <class 'bytes'>
def _validate_elements(
attribute: attr.Attribute[typing.Any],
value: typing.Any,
expected_type: type[typing.Any] | None,
) -> None:
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: object_id must be <class 'bytes'> (got 4dbcd76a0da0f04da728d52eb407de179e3d848c that is a <class 'str'>)
.tox/py3/lib/python3.7/site-packages/attrs_strict/_type_validation.py:133: AttributeTypeError
TEST RESULT
TEST RESULT
- Run At
- Apr 27 2022, 10:12 PM