docs
This commit is contained in:
32
ontology_platform/tests/unit/test_dedup_cache.py
Normal file
32
ontology_platform/tests/unit/test_dedup_cache.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from ont_platform.storage.dedup_cache import InMemoryDedupCache
|
||||
|
||||
|
||||
def test_dedup_cache_remembers_project_scoped_fingerprint() -> None:
|
||||
cache = InMemoryDedupCache()
|
||||
|
||||
first = cache.check_and_remember(
|
||||
project_id="proj_1",
|
||||
document_id="doc_a",
|
||||
content_hash="hash-a",
|
||||
fingerprint="fingerprint-a",
|
||||
)
|
||||
second = cache.check_and_remember(
|
||||
project_id="proj_1",
|
||||
document_id="doc_b",
|
||||
content_hash="hash-b",
|
||||
fingerprint="fingerprint-a",
|
||||
)
|
||||
other_project = cache.check_and_remember(
|
||||
project_id="proj_2",
|
||||
document_id="doc_c",
|
||||
content_hash="hash-c",
|
||||
fingerprint="fingerprint-a",
|
||||
)
|
||||
|
||||
assert first.is_duplicate is False
|
||||
assert second.is_duplicate is True
|
||||
assert second.existing_document_id == "doc_a"
|
||||
assert other_project.is_duplicate is False
|
||||
assert len(cache) == 2
|
||||
Reference in New Issue
Block a user