27 lines
927 B
Python
27 lines
927 B
Python
"""Contract tests for versioned prompts verifying 6-block sequence and parity."""
|
|
|
|
import hashlib
|
|
from pathlib import Path
|
|
|
|
|
|
def test_prompts_6_block_architecture():
|
|
prompts_dir = Path("prompts")
|
|
prompt_files = list(prompts_dir.glob("*.txt"))
|
|
assert len(prompt_files) >= 2
|
|
|
|
for p_file in prompt_files:
|
|
content = p_file.read_text(encoding="utf-8")
|
|
assert "# BLOCK 1: SYSTEM ROLE & OBJECTIVE" in content
|
|
assert "# BLOCK 2: TASK INSTRUCTIONS" in content
|
|
assert "# BLOCK 3:" in content
|
|
assert "# BLOCK 4: OUTPUT CONTRACT SPECIFICATION" in content
|
|
assert "# BLOCK 5: QUALITY GUARDRAILS" in content
|
|
assert "# BLOCK 6: INPUT DATA PAYLOAD" in content
|
|
|
|
|
|
def test_prompts_sha256_calculation():
|
|
prompts_dir = Path("prompts")
|
|
for p_file in prompts_dir.glob("*.txt"):
|
|
sha = hashlib.sha256(p_file.read_bytes()).hexdigest()
|
|
assert len(sha) == 64
|