def test_revision_model_id_computation():
rev_dict = revision_example.copy()
del rev_dict["id"]
rev_id = hash_to_bytes(revision_identifier(rev_dict))
> rev_model = Revision.from_dict(rev_dict)
.tox/py3/lib/python3.7/site-packages/swh/model/tests/test_model.py:434:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/model/model.py:448: in from_dict
**d,
<attrs generated init swh.model.model.Revision>:24: in __init__
__attr_validator_parents(self, __attr_parents, self.parents)
.tox/py3/lib/python3.7/site-packages/attrs_strict/_type_validation.py:34: in _validator
_validate_elements(attribute, field, attribute.type)
.tox/py3/lib/python3.7/site-packages/attrs_strict/_type_validation.py:68: in _validate_elements
_handle_tuple(attribute, value, expected_type)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attribute = Attribute(name='parents', default=(), validator=<function type_validator.<locals>._validator at 0x7f718e044ae8>, repr=...er=True, hash=None, init=True, metadata=mappingproxy({}), type=typing.Tuple[bytes, ...], converter=None, kw_only=False)
container = (b'\x01\xe2\xd0bz\x9an\xdb$\xc3}\xb4]\xb5\xec\xb3\x1e\x9d\xe8\x08',)
expected_type = typing.Tuple[bytes, ...]
def _handle_tuple(attribute, container, expected_type):
tuple_types = expected_type.__args__
if len(container) != len(tuple_types):
> raise TupleError(container, attribute.type, tuple_types)
E attrs_strict._error.TupleError: Element (b'\x01\xe2\xd0bz\x9an\xdb$\xc3}\xb4]\xb5\xec\xb3\x1e\x9d\xe8\x08',) has less elements than types specified in typing.Tuple[bytes, ...]. Expected 2 received 1
.tox/py3/lib/python3.7/site-packages/attrs_strict/_type_validation.py:100: TupleError
TEST RESULT
TEST RESULT
- Run At
- May 25 2020, 1:46 PM