Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/tests/test_provenance_storage.py
Show First 20 Lines • Show All 425 Lines • ▼ Show 20 Lines | for cnt in {cnt["sha1_git"] for cnt in data["content"]}: | ||||
provenance.storage.content_find_first(cnt), provenance_storage.with_path() | provenance.storage.content_find_first(cnt), provenance_storage.with_path() | ||||
) == provenance_storage.content_find_first(cnt) | ) == provenance_storage.content_find_first(cnt) | ||||
assert { | assert { | ||||
adapt_result(occur, provenance_storage.with_path()) | adapt_result(occur, provenance_storage.with_path()) | ||||
for occur in provenance.storage.content_find_all(cnt) | for occur in provenance.storage.content_find_all(cnt) | ||||
} == set(provenance_storage.content_find_all(cnt)) | } == set(provenance_storage.content_find_all(cnt)) | ||||
def test_types(provenance_storage: ProvenanceInterface) -> None: | def test_types(provenance_storage: ProvenanceStorageInterface) -> None: | ||||
"""Checks all methods of ProvenanceStorageInterface are implemented by this | """Checks all methods of ProvenanceStorageInterface are implemented by this | ||||
backend, and that they have the same signature.""" | backend, and that they have the same signature.""" | ||||
# Create an instance of the protocol (which cannot be instantiated | # Create an instance of the protocol (which cannot be instantiated | ||||
# directly, so this creates a subclass, then instantiates it) | # directly, so this creates a subclass, then instantiates it) | ||||
interface = type("_", (ProvenanceStorageInterface,), {})() | interface = type("_", (ProvenanceStorageInterface,), {})() | ||||
assert "content_find_first" in dir(interface) | assert "content_find_first" in dir(interface) | ||||
Show All 26 Lines |