Phase 11
This commit is contained in:
commit
c5bcb95d74
172 files changed
+9487
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import csv
|
||||
from pathlib import Path
|
||||
|
||||
from src.config_loader import VoiceLoggingSettings
|
||||
from src.models import VoicePromptDecision, VoicePromptEvent, VoicePromptTrackState
|
||||
from src.voice_logger import VoiceLogger
|
||||
|
||||
|
||||
def test_voice_csvs_bom_json_control_and_dedup(tmp_path: Path) -> None:
|
||||
config = VoiceLoggingSettings(True, True, True, True, 1, str(tmp_path))
|
||||
logger = VoiceLogger(config, "exp", "stamp")
|
||||
logger.open()
|
||||
logger.write_decisions([VoicePromptDecision(1, 2, "t", 1., "control", True, True, False, True, "pseudo", None)])
|
||||
logger.write_events([VoicePromptEvent("pseudo_prompt_triggered", 1, 2, "t", 1., "control",
|
||||
pseudo_prompt=True, metadata={"日本語": "声掛けなし"})])
|
||||
state = VoicePromptTrackState(1, "control", eligible=True, pseudo_prompt=True, finalized=True)
|
||||
logger.write_summary(state)
|
||||
logger.write_summary(state)
|
||||
logger.close()
|
||||
logger.close()
|
||||
for path in tmp_path.glob("*.csv"):
|
||||
assert path.read_bytes().startswith(b"\xef\xbb\xbf")
|
||||
event_text = (tmp_path / "stamp_exp_voice_events.csv").read_text(encoding="utf-8-sig")
|
||||
assert "日本語" in event_text and "声掛けなし" in event_text
|
||||
with (tmp_path / "stamp_exp_voice_summary.csv").open(encoding="utf-8-sig", newline="") as stream:
|
||||
assert len(list(csv.DictReader(stream))) == 1
|
||||
Reference in new issue
Block a user