(tmp_path)
| 201 | |
| 202 | |
| 203 | def test_hash_registry_remove_by_doc_name(tmp_path): |
| 204 | path = tmp_path / "hashes.json" |
| 205 | path.write_text( |
| 206 | json.dumps( |
| 207 | { |
| 208 | "h1": {"name": "a.pdf", "doc_name": "a-h1", "type": "short"}, |
| 209 | "h2": {"name": "b.pdf", "doc_name": "b-h2", "type": "short"}, |
| 210 | } |
| 211 | ) |
| 212 | ) |
| 213 | |
| 214 | reg = HashRegistry(path) |
| 215 | assert reg.remove_by_doc_name("a-h1") is True |
| 216 | assert reg.remove_by_doc_name("a-h1") is False # already gone |
| 217 | assert "h2" in reg.all_entries() and "h1" not in reg.all_entries() |
| 218 | |
| 219 | # Persisted to disk |
| 220 | saved = json.loads(path.read_text()) |
| 221 | assert list(saved.keys()) == ["h2"] |
| 222 | |
| 223 | |
| 224 | def test_hash_registry_remove_by_hash(tmp_path): |
nothing calls this directly
no test coverage detected