chore(assets): 参赛提交规范红线修复(ASCII 化 + 相对路径)
按《参赛成果物提交规范·赛道一》§6 红线: - samples/ 目录改名 sample/(git mv,保留历史) - 10 个中日文样本文件 + docs 参赛手册 PDF 重命名为 ASCII (requirements_*/template_*/rules_*/contestant-handbook.pdf) - tests/test_zh_template.py 硬编码绝对路径 D:\00_project\Genesis 改为相对路径 - 全局更新 21 个活动文件引用;历史日志/审查文档不改(追加说明记录) 全量 pytest 431 passed / 99.15%
This commit is contained in:
@@ -115,7 +115,7 @@ def test_parse_missing_root_raises(tmp_path):
|
||||
|
||||
|
||||
def test_parse_real_sample_has_order_controller():
|
||||
root = Path(__file__).resolve().parents[1] / "samples" / "existing-system"
|
||||
root = Path(__file__).resolve().parents[1] / "sample" / "existing-system"
|
||||
if not root.exists():
|
||||
pytest.skip("样本缺失")
|
||||
result = CodeParser().parse(root)
|
||||
@@ -125,7 +125,7 @@ def test_parse_real_sample_has_order_controller():
|
||||
|
||||
|
||||
def test_parse_real_sample_has_entities_and_endpoints():
|
||||
root = Path(__file__).resolve().parents[1] / "samples" / "existing-system"
|
||||
root = Path(__file__).resolve().parents[1] / "sample" / "existing-system"
|
||||
if not root.exists():
|
||||
pytest.skip("样本缺失")
|
||||
result = CodeParser().parse(root)
|
||||
|
||||
@@ -58,8 +58,8 @@ def test_structured_source_assembles_all():
|
||||
tables=[],
|
||||
template=ParsedTemplate(file_name="t.docx", sections=[], placeholders={}, styles={}),
|
||||
rule_docs=[RuleDocument(
|
||||
file_name="記入規則.docx", category="write", markdown_content="# 規則",
|
||||
source_path="samples/記入規則.docx", file_type="word", hash="abc",
|
||||
file_name="rules_entry_ja.docx", category="write", markdown_content="# 規則",
|
||||
source_path="sample/rules_entry_ja.docx", file_type="word", hash="abc",
|
||||
)],
|
||||
image_analyses=[ImageAnalysis(
|
||||
image_ref="img1", description="画面遷移図", confidence=0.9,
|
||||
|
||||
@@ -161,7 +161,7 @@ def test_golden_set_load(tmp_path):
|
||||
yaml_text = """
|
||||
cases:
|
||||
- id: g1
|
||||
input_ref: samples/要件定義.xlsx
|
||||
input_ref: sample/要件定義.xlsx
|
||||
expected_min_score: 0.7
|
||||
note: 脱敏真实样本回归基线
|
||||
"""
|
||||
|
||||
@@ -38,7 +38,7 @@ def _existing() -> ExistingSystemInfo:
|
||||
EntityInfo("StrategyBacktest", "StrategyBacktest", "SB.java", "ts_strategy_backtest", [], "trade-strategy/SB.java"),
|
||||
],
|
||||
api_endpoints=[],
|
||||
source_path="samples/existing-system",
|
||||
source_path="sample/existing-system",
|
||||
)
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ def test_metadata_and_summary_shape():
|
||||
report = ImpactAgent().run(_ss(_existing(), tables), session_id="sess-1")
|
||||
assert report.metadata["version"] == "v1"
|
||||
assert report.metadata["session_id"] == "sess-1"
|
||||
assert report.metadata["source"] == "samples/existing-system"
|
||||
assert report.metadata["source"] == "sample/existing-system"
|
||||
assert report.summary["total"] == 1
|
||||
assert report.summary["new"] == 1
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ def test_writer_agent_zh_expected_rejects_japanese():
|
||||
|
||||
def test_qa_loop_passes_with_explicit_zh_on_chinese_fake(tmp_path):
|
||||
"""显式 zh + 中文 Fake → 语言维度通过(验证透传链路)。"""
|
||||
template = Path("samples/phase5-slice/template.docx")
|
||||
template = Path("sample/phase5-slice/template.docx")
|
||||
if not template.exists():
|
||||
import pytest
|
||||
pytest.skip("样本模板缺失")
|
||||
@@ -75,7 +75,7 @@ def test_qa_loop_passes_with_explicit_zh_on_chinese_fake(tmp_path):
|
||||
|
||||
def test_qa_loop_fails_with_explicit_ja_on_chinese_fake(tmp_path):
|
||||
"""显式 ja + 中文 Fake → 语言维度判失败。"""
|
||||
template = Path("samples/phase5-slice/template.docx")
|
||||
template = Path("sample/phase5-slice/template.docx")
|
||||
if not template.exists():
|
||||
import pytest
|
||||
pytest.skip("样本模板缺失")
|
||||
|
||||
@@ -39,7 +39,7 @@ class _FlakyEngine:
|
||||
|
||||
|
||||
def _ss() -> StructuredSource:
|
||||
template = Path("samples/phase5-slice/template.docx")
|
||||
template = Path("sample/phase5-slice/template.docx")
|
||||
if not template.exists():
|
||||
pytest.skip("样本模板缺失,跳过")
|
||||
parsed = WordTemplateParser().parse(str(template))
|
||||
@@ -54,7 +54,7 @@ def test_generate_recovers_stochastic_single_chapter_failure(tmp_path):
|
||||
# chapter_attempts=3,内部 max_retries=2 → 单章最多约 3×2 次调用
|
||||
contents = WriteOrchestrator().generate(
|
||||
_ss(), str(out), samples_dir="nonexistent_dir_xyz",
|
||||
engine=engine, template_path=str(Path("samples/phase5-slice/template.docx")),
|
||||
engine=engine, template_path=str(Path("sample/phase5-slice/template.docx")),
|
||||
)
|
||||
assert contents, "应成功产出章节"
|
||||
assert out.is_file()
|
||||
@@ -72,6 +72,6 @@ def test_generate_hard_fails_after_chapter_attempts_exhausted(tmp_path):
|
||||
with pytest.raises(WriterGenerationError):
|
||||
WriteOrchestrator().generate(
|
||||
_ss(), str(out), samples_dir="nonexistent_dir_xyz",
|
||||
engine=AlwaysFail(0), template_path=str(Path("samples/phase5-slice/template.docx")),
|
||||
engine=AlwaysFail(0), template_path=str(Path("sample/phase5-slice/template.docx")),
|
||||
chapter_attempts=1,
|
||||
)
|
||||
|
||||
@@ -36,7 +36,7 @@ def _all_text(doc: Document) -> str:
|
||||
|
||||
|
||||
def test_phase5_e2e_fake_llm(tmp_path):
|
||||
template = Path("samples/phase5-slice/template.docx")
|
||||
template = Path("sample/phase5-slice/template.docx")
|
||||
if not template.exists():
|
||||
pytest.skip("样本模板缺失,跳过 e2e")
|
||||
parsed = WordTemplateParser().parse(str(template))
|
||||
|
||||
@@ -3,7 +3,7 @@ from genesis.services.rag_service import RagService, CannedRagService
|
||||
|
||||
|
||||
def test_canned_rag_returns_rules():
|
||||
svc = CannedRagService(samples_dir="samples")
|
||||
svc = CannedRagService(samples_dir="sample")
|
||||
rules = svc.retrieve_write_rules("db_design")
|
||||
assert isinstance(rules, list)
|
||||
rules2 = svc.retrieve_design_rules("db_design")
|
||||
@@ -11,4 +11,4 @@ def test_canned_rag_returns_rules():
|
||||
|
||||
|
||||
def test_rag_service_is_protocol():
|
||||
assert isinstance(CannedRagService("samples"), RagService)
|
||||
assert isinstance(CannedRagService("sample"), RagService)
|
||||
|
||||
+12
-12
@@ -7,7 +7,7 @@ from genesis.parsers.rule_doc_parser import RuleDocParser
|
||||
from genesis.parsers.source_aggregator import SourceParser
|
||||
from genesis.parsers.word_template_parser import WordTemplateParser
|
||||
|
||||
SAMPLES = Path(__file__).resolve().parents[1] / "samples"
|
||||
SAMPLES = Path(__file__).resolve().parents[1] / "sample"
|
||||
|
||||
|
||||
def _d(name: str) -> Path:
|
||||
@@ -19,7 +19,7 @@ def _x(name: str) -> Path:
|
||||
|
||||
|
||||
def test_new_dev_sample_has_tables():
|
||||
p = _x("要件定義_新規開発.xlsx")
|
||||
p = _x("requirements_newdev.xlsx")
|
||||
if not p.exists():
|
||||
pytest.skip("样本缺失")
|
||||
result = ExcelParser().parse(p)
|
||||
@@ -30,7 +30,7 @@ def test_new_dev_sample_has_tables():
|
||||
|
||||
|
||||
def test_additional_modification_has_tables():
|
||||
p = _x("要件定義_追加改修.xlsx")
|
||||
p = _x("requirements_enhancement.xlsx")
|
||||
if not p.exists():
|
||||
pytest.skip("样本缺失")
|
||||
result = ExcelParser().parse(p)
|
||||
@@ -39,7 +39,7 @@ def test_additional_modification_has_tables():
|
||||
|
||||
|
||||
def test_free_text_sample_detected():
|
||||
p = _x("要件定義_自由記述.xlsx")
|
||||
p = _x("requirements_freetext.xlsx")
|
||||
if not p.exists():
|
||||
pytest.skip("样本缺失")
|
||||
result = ExcelParser().parse(p)
|
||||
@@ -47,7 +47,7 @@ def test_free_text_sample_detected():
|
||||
|
||||
|
||||
def test_mixed_sample_segments_detected():
|
||||
p = _x("要件定義_混合型.xlsx")
|
||||
p = _x("requirements_mixed.xlsx")
|
||||
if not p.exists():
|
||||
pytest.skip("样本缺失")
|
||||
result = ExcelParser().parse(p)
|
||||
@@ -68,7 +68,7 @@ def test_mixed_sample_segments_detected():
|
||||
|
||||
|
||||
def test_word_template_sample_chapters_and_placeholders():
|
||||
p = _d("概要設計書テンプレート.docx")
|
||||
p = _d("template_design_ja.docx")
|
||||
if not p.exists():
|
||||
pytest.skip("样本缺失")
|
||||
result = WordTemplateParser().parse(p)
|
||||
@@ -85,7 +85,7 @@ def test_word_template_sample_chapters_and_placeholders():
|
||||
|
||||
|
||||
def test_rule_doc_sample_markdown_and_category():
|
||||
p = _d("記入規則.docx")
|
||||
p = _d("rules_entry_ja.docx")
|
||||
if not p.exists():
|
||||
pytest.skip("样本缺失")
|
||||
result = RuleDocParser().parse(p, category="write")
|
||||
@@ -96,7 +96,7 @@ def test_rule_doc_sample_markdown_and_category():
|
||||
|
||||
|
||||
def test_write_instruction_sample_category_write():
|
||||
p = _d("概要設計做成説明書.docx")
|
||||
p = _d("rules_design_ja.docx")
|
||||
if not p.exists():
|
||||
pytest.skip("样本缺失")
|
||||
result = RuleDocParser().parse(p, category="write")
|
||||
@@ -105,10 +105,10 @@ def test_write_instruction_sample_category_write():
|
||||
|
||||
|
||||
def test_source_parser_full_sample_assembly():
|
||||
xlsx = _x("要件定義_新規開発.xlsx")
|
||||
template = _d("概要設計書テンプレート.docx")
|
||||
rule = _d("記入規則.docx")
|
||||
instr = _d("概要設計做成説明書.docx")
|
||||
xlsx = _x("requirements_newdev.xlsx")
|
||||
template = _d("template_design_ja.docx")
|
||||
rule = _d("rules_entry_ja.docx")
|
||||
instr = _d("rules_design_ja.docx")
|
||||
if not all(p.exists() for p in [xlsx, template, rule, instr]):
|
||||
pytest.skip("样本缺失")
|
||||
result = SourceParser().parse(
|
||||
|
||||
@@ -14,9 +14,9 @@ from docx import Document
|
||||
from genesis.parsers.word_template_parser import WordTemplateParser
|
||||
from genesis.writer.template_mapper import map_template
|
||||
|
||||
_SAMPLES = Path(r"D:\00_project\Genesis\samples")
|
||||
_JA = _SAMPLES / "概要設計書テンプレート.docx"
|
||||
_ZH = _SAMPLES / "概要设计书模板_中文.docx"
|
||||
_SAMPLES = Path(__file__).resolve().parents[1] / "sample"
|
||||
_JA = _SAMPLES / "template_design_ja.docx"
|
||||
_ZH = _SAMPLES / "template_design_zh.docx"
|
||||
|
||||
|
||||
EXPECTED_ANCHORS = [
|
||||
@@ -27,9 +27,9 @@ EXPECTED_ANCHORS = [
|
||||
|
||||
@pytest.fixture
|
||||
def zh_template(tmp_path):
|
||||
"""生成 zh 模板到临时目录并返回路径(不污染 samples/)。"""
|
||||
"""生成 zh 模板到临时目录并返回路径(不污染 sample/)。"""
|
||||
from scripts.make_zh_template import build_zh_template
|
||||
dst = tmp_path / "概要设计书模板_中文.docx"
|
||||
dst = tmp_path / "template_design_zh.docx"
|
||||
build_zh_template(str(_JA), str(dst))
|
||||
return dst
|
||||
|
||||
|
||||
Reference in New Issue
Block a user