def test_directory_model_id_computation():
dir_dict = directory_example.copy()
del dir_dict["id"]
dir_id = hash_to_bytes(directory_identifier(dir_dict))
> dir_model = Directory.from_dict(dir_dict)
.tox/py3/lib/python3.7/site-packages/swh/model/tests/test_model.py:425:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/model/model.py:487: in from_dict
**d,
<attrs generated init swh.model.model.Directory>:6: in __init__
__attr_validator_entries(self, __attr_entries, self.entries)
.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='entries', default=NOTHING, validator=<function type_validator.<locals>._validator at 0x7f718e044730>, ...True, metadata=mappingproxy({}), type=typing.Tuple[swh.model.model.DirectoryEntry, ...], converter=None, kw_only=False)
container = (DirectoryEntry(name=b'README', type='file', target=b'7\xec\x8e\xa2\x11\x0c\x0bz2\xfb\xb0\xe8r\xf6\xe7\xde\xbb\xf9^!',...=b'public', type='dir', target=b'\x95\x88\xbfE"\xc2\xb4d\x8b\xfd\x1ca\xd1u\xd1\xf8\x8c\x1a\xd4\xa5', perms=16384), ...)
expected_type = typing.Tuple[swh.model.model.DirectoryEntry, ...]
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 (DirectoryEntry(name=b'README', type='file', target=b'7\xec\x8e\xa2\x11\x0c\x0bz2\xfb\xb0\xe8r\xf6\xe7\xde\xbb\xf9^!', perms=33188), DirectoryEntry(name=b'Rakefile', type='file', target=b';\xb0\xe8Y*A\xae1\x85\xee2&l\x86\x07\x14\x98\r\xbe\xd7', perms=33188), DirectoryEntry(name=b'app', type='dir', target=b'a\xe6\xe8g\xf5\xd7\xba;@T\x08i\xbc\x05\x0b\x0cO\xed\x9e\x95', perms=16384), DirectoryEntry(name=b'1.megabyte', type='file', target=b'|+/\xbd\xd5}ge\xcd\xc9\xd8L-}3?\x11\xbe\x7f\xb3', perms=33188), DirectoryEntry(name=b'config', type='dir', target=b'Y\x1d\xfexJ.\x9c\xccc\xaa\xba\x1c\xb6\x8avW41\r\x98', perms=16384), DirectoryEntry(name=b'public', type='dir', target=b'\x95\x88\xbfE"\xc2\xb4d\x8b\xfd\x1ca\xd1u\xd1\xf8\x8c\x1a\xd4\xa5', perms=16384), DirectoryEntry(name=b'development.sqlite3', type='file', target=b'\xe6\x9d\xe2\x9b\xb2\xd1\xd6CK\x8b)\xaewZ\xd8\xc2\xe4\x8cS\x91', perms=33188), DirectoryEntry(name=b'doc', type='dir', target=b'\x15G\x05\xc6\xaa\x1c\x8e\xad\x8c\x99\xc7\x91Ss\xe3\xc4@\x12\x05\x7f', perms=16384), DirectoryEntry(name=b'db', type='dir', target=b'\x85\xf1W\xbd\xc3\x93V\xb7\xbc}\xe9\xd0\t\x9bL\xed\x8b;8,', perms=16384), DirectoryEntry(name=b'log', type='dir', target=b'^=9A\xc5\x1c\xces5-\xff\x89\xc8\x05\xa3\x04\xba\x96\xff\xfe', perms=16384), DirectoryEntry(name=b'script', type='dir', target=b"\x1b'\x84#\xca\xf1v\xda?53Y \x12P*\xa1\x0fVl", perms=16384), DirectoryEntry(name=b'test', type='dir', target=b'\x03_\x047\xc0\x80\xbf\xd8q\x16p\xb3\xe8g~hli\xc7c', perms=16384), DirectoryEntry(name=b'vendor', type='dir', target=b'|\r\xc9\xad\x97\x8c\x1a\xf3\xf9\xa4\xce\x06\x1eP\xf5\x91\x8b\xd2q8', perms=16384), DirectoryEntry(name=b'will_paginate', type='rev', target=b'=S\x1e\x16\x9d\xb9*\x16\xa9\xa8\x97O\n\xe6\xed\xf5.Re\x9e', perms=57344), DirectoryEntry(name=b'order', type='dir', target=b'b\xcd\xb7\x02\x0f\xf9 \xe5\xaad,=@f\x95\r\xd1\xf0\x1fM', perms=16384), DirectoryEntry(name=b'order.', type='file', target=b'\x0b\xee\xc7\xb5\xea?\x0f\xdb\xc9]\r\xd4\x7f<[\xc2u\xda\x8a3', perms=16384), DirectoryEntry(name=b'order0', type='file', target=b'\xbb\xe9`\xa2^\xa3\x11\xd2\x1d@f\x9e\x93\xdf \x03\xba\x9b\x90\xa2', perms=16384)) has more elements than types specified in typing.Tuple[swh.model.model.DirectoryEntry, ...]. Expected 2 received 17
.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