chore: bootstrap repository with governance docs
Initialize git, add Apache-2.0 LICENSE, .gitattributes (LF line endings), AGENTS.md (entry points, stack, discovery order, baseline checks), RUNBOOK.md (dev boot, prod deploy with overlay, ingestion, failures, rollback, scaling notes), .env.prod.example with rotated credential placeholders, and dev-only warnings on .env.example. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
22
tests/test_duplicates.py
Normal file
22
tests/test_duplicates.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from app.utils.hashing import sha256_file
|
||||
|
||||
|
||||
def test_two_files_with_same_content_share_sha(tmp_path: Path):
|
||||
a = tmp_path / "a.pdf"
|
||||
b = tmp_path / "b.pdf"
|
||||
payload = b"%PDF-1.4\n" + b"x" * 4096
|
||||
a.write_bytes(payload)
|
||||
b.write_bytes(payload)
|
||||
assert sha256_file(a) == sha256_file(b)
|
||||
|
||||
|
||||
def test_one_byte_difference_changes_sha(tmp_path: Path):
|
||||
a = tmp_path / "a.pdf"
|
||||
b = tmp_path / "b.pdf"
|
||||
a.write_bytes(b"%PDF-1.4\n" + b"x" * 4096)
|
||||
b.write_bytes(b"%PDF-1.4\n" + b"x" * 4095 + b"y")
|
||||
assert sha256_file(a) != sha256_file(b)
|
||||
Reference in New Issue
Block a user