self = <swh.model.tests.test_from_disk.TarballTest testMethod=test_contents_match>
def test_contents_match(self):
directory = Directory.from_disk(
path=os.path.join(self.tmpdir_name, b"sample-folder")
)
for name, expected in self.tarball_contents.items():
obj = directory[name]
if isinstance(obj, Content):
self.assertContentEqual(obj, expected)
elif isinstance(obj, Directory):
> self.assertDirectoryEqual(obj, expected)
.tox/py3/lib/python3.7/site-packages/swh/model/tests/test_from_disk.py:856:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/model/tests/test_from_disk.py:496: in assertDirectoryEqual
assert left.to_model() == model.Directory.from_dict(right)
.tox/py3/lib/python3.7/site-packages/swh/model/from_disk.py:370: in to_model
return model.Directory.from_dict(self.get_data())
.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'bar', type='dir', target=b'<\x1fW\x83\x94\xf4b?t\xa0\xba\x7f\xe7ar\x9fY\xfcn\xc4', perms=<Dentr...e='file', target=b'\x19\x10(\x15f=#\xf8\xb7ZG\xe7\xa0\x19e\xdc\xdc\x96F\x8c', perms=<DentryPerms.symlink: 40960>), ...)
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'bar', type='dir', target=b'<\x1fW\x83\x94\xf4b?t\xa0\xba\x7f\xe7ar\x9fY\xfcn\xc4', perms=<DentryPerms.directory: 16384>), DirectoryEntry(name=b'empty-folder', type='dir', target=b'K\x82]\xc6B\xcbn\xb9\xa0`\xe5K\xf8\xd6\x92\x88\xfb\xeeI\x04', perms=<DentryPerms.directory: 16384>), DirectoryEntry(name=b'foo', type='dir', target=b'+A\xc4\x0f\r\x1f\xbf\xfc\xba\x12I}\xb7\x1f\xba\x83\xfc\xca\x96\xe5', perms=<DentryPerms.directory: 16384>), DirectoryEntry(name=b'link-to-another-quote', type='file', target=b'}\\\x08\x11\x1e!\xc8\xa9\xf7\x15@\x93\x99\x98U\x16\x837_\xad', perms=<DentryPerms.symlink: 40960>), DirectoryEntry(name=b'link-to-binary', type='file', target=b'\xe8kE\xe58\xd9\xb6\x88\x8c\x96\x9c\x89\xfb\xd2*\x85\xaa\x0e\x03f', perms=<DentryPerms.symlink: 40960>), DirectoryEntry(name=b'link-to-foo', type='file', target=b'\x19\x10(\x15f=#\xf8\xb7ZG\xe7\xa0\x19e\xdc\xdc\x96F\x8c', perms=<DentryPerms.symlink: 40960>), DirectoryEntry(name=b'some-binary', type='file', target=b'hv\x95y\xc3\xea\xad\xbeUSy\xb9\xc3S\x8ef(\xba\xe1\xeb', perms=<DentryPerms.executable_content: 33261>)) has more elements than types specified in typing.Tuple[swh.model.model.DirectoryEntry, ...]. Expected 2 received 7
.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