You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

8 lines
992 B

import csv
from pathlib import Path
from src.pilot_session_reporter import PilotSessionReporter
def test_report_reads_phase8_and_exports(tmp_path:Path)->None:
fields=["condition","total_records","valid_voice_analysis_count","response_rate","mean_reaction_time_sec"]
with (tmp_path/"condition_summary.csv").open("w",encoding="utf-8-sig",newline="") as f:w=csv.DictWriter(f,fieldnames=fields);w.writeheader();w.writerows([{"condition":"prompt","total_records":10,"valid_voice_analysis_count":8,"response_rate":.5,"mean_reaction_time_sec":1.2},{"condition":"control","total_records":10,"valid_voice_analysis_count":7,"response_rate":.2,"mean_reaction_time_sec":1.4}])
r=PilotSessionReporter();report=r.build_report(tmp_path);assert report.rate_difference==.3;assert "因果関係" in r.export_markdown(report,tmp_path/"pilot.md").read_text(encoding="utf-8")
def test_empty_report_is_generated(tmp_path:Path)->None:assert PilotSessionReporter().build_report(tmp_path).total_tracks==0