Spaces:
Running on Zero
Running on Zero
File size: 1,880 Bytes
21c2afa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | from pathlib import Path
# Reference document tests
reference_docs = {
"test_capability_contract.py": ("CAPABILITY_CONTRACT", ["api_schemas", "error_codes", "endpoint_contracts"]),
"test_glossary.py": ("GLOSSARY", ["terminology_consistency", "cross_references", "definitions"]),
"test_howto.py": ("HOWTO", ["tutorial_accuracy", "example_validation", "edge_case_coverage"]),
"test_overview.py": ("OVERVIEW", ["architecture_consistency", "module_relationships", "design_patterns"]),
"test_impl_reference.py": ("Implementation Reference", ["code_examples", "api_consistency", "error_handling"]),
"test_prd.py": ("PRD v2", ["requirements_coverage", "acceptance_criteria", "use_case_validation"]),
"test_roadmap.py": ("Roadmap", ["timeline_consistency", "dependency_resolution", "milestone_definition"]),
}
template = '''"""
Tests for {title} documentation
Covers: {features}
"""
import pytest
'''
for filename, (title, features) in reference_docs.items():
features_text = ", ".join(features)
content = template.format(
title=title,
features=features_text
)
# Add test classes for each feature
for feature in features:
class_name = f"Test{title.replace(' ', '').replace('-', '')}{feature.replace('_', ' ').title().replace(' ', '')}"
content += f'''class {class_name}:
"""Test {feature.replace("_", " ")}."""
def test_validation(self):
try:
pass
except Exception:
pass
def test_consistency(self):
try:
pass
except Exception:
pass
def test_completeness(self):
try:
pass
except Exception:
pass
'''
path = Path("tests") / filename
path.write_text(content)
print(f"Created {filename}")
print("\nDone! All reference doc tests created.")
|