directory = Directory(entries=(DirectoryEntry(name=b'', type='file', target=hash_to_bytes('0000000000000000000000000000000000000000'), perms=0o100000),), id=hash_to_bytes('5ba93c9db0cff93f52b521d7420e43f6eda2784f'), raw_manifest=b'\x00')
@given(strategies.directories())
def test_directory_check(directory):
directory.check()
directory2 = attr.evolve(directory, id=b"\x00" * 20)
with pytest.raises(ValueError, match="does not match recomputed hash"):
directory2.check()
directory2 = attr.evolve(
directory, raw_manifest=swh.model.git_objects.directory_git_object(directory)
)
with pytest.raises(
ValueError, match="non-none raw_manifest attribute, but does not need it."
):
> directory2.check()
.tox/py3-full/lib/python3.7/site-packages/swh/model/tests/test_model.py:770:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Directory(entries=(DirectoryEntry(name=b'', type='file', target=hash_to_bytes('000000000000000000000000000000000000000...raw_manifest=b'tree 28\x00100000 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
def check(self) -> None:
> super().check()
.tox/py3-full/lib/python3.7/site-packages/swh/model/model.py:272:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Directory(entries=(DirectoryEntry(name=b'', type='file', target=hash_to_bytes('000000000000000000000000000000000000000...raw_manifest=b'tree 28\x00100000 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
def check(self) -> None:
super().check() # type: ignore
if self.id != self.compute_hash():
> raise ValueError("'id' does not match recomputed hash.")
E ValueError: 'id' does not match recomputed hash.
.tox/py3-full/lib/python3.7/site-packages/swh/model/model.py:239: ValueError
During handling of the above exception, another exception occurred:
@given(strategies.directories())
> def test_directory_check(directory):
.tox/py3-full/lib/python3.7/site-packages/swh/model/tests/test_model.py:757:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
directory = Directory(entries=(DirectoryEntry(name=b'', type='file', target=hash_to_bytes('0000000000000000000000000000000000000000'), perms=0o100000),), id=hash_to_bytes('5ba93c9db0cff93f52b521d7420e43f6eda2784f'), raw_manifest=b'\x00')
@given(strategies.directories())
def test_directory_check(directory):
directory.check()
directory2 = attr.evolve(directory, id=b"\x00" * 20)
with pytest.raises(ValueError, match="does not match recomputed hash"):
directory2.check()
directory2 = attr.evolve(
directory, raw_manifest=swh.model.git_objects.directory_git_object(directory)
)
with pytest.raises(
ValueError, match="non-none raw_manifest attribute, but does not need it."
):
> directory2.check()
E AssertionError: Regex pattern 'non-none raw_manifest attribute, but does not need it.' does not match "'id' does not match recomputed hash.".
.tox/py3-full/lib/python3.7/site-packages/swh/model/tests/test_model.py:770: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Dec 15 2021, 6:56 PM