From 764a892b43ba55e3d96b0d8986c64cd6b5d42236 Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Sun, 12 Jul 2026 22:28:14 +0900 Subject: waveファイルの出力先変更 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mmlファイルをwaveファイルと一緒に出力するように変更 サンプルデータ追加 --- tests/test_compose_mml_tool.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/test_compose_mml_tool.py b/tests/test_compose_mml_tool.py index be4735e..944711f 100644 --- a/tests/test_compose_mml_tool.py +++ b/tests/test_compose_mml_tool.py @@ -174,8 +174,8 @@ def test_compose_normalize(compose_mml, tmp_output_dir): assert Path(off["wav_path"]).exists() -def test_compose_unique_filename(compose_mml, tmp_output_dir): - """Each compose call should produce a distinct WAV filename.""" +def test_compose_creates_timestamped_output_directory(compose_mml, tmp_output_dir): + """Compose writes the WAV and source MML in a timestamped directory.""" mml = """A t120 l4 o4 v15 q2 c4 """ @@ -188,20 +188,23 @@ def test_compose_unique_filename(compose_mml, tmp_output_dir): path2 = result2["wav_path"] assert path1 is not None assert path2 is not None - assert path1 != path2, "Two compose calls produced the same wav_path" + assert path1 != path2, "Two compose calls produced the same output directory" p1 = Path(path1) p2 = Path(path2) assert p1.exists() assert p2.exists() - assert p1.name.startswith("output_") - assert p1.name.endswith(".wav") - assert p2.name.startswith("output_") - assert p2.name.endswith(".wav") - - # Ensure the filename follows the expected timestamp pattern. + assert p1.name == "output.wav" + assert p2.name == "output.wav" + assert p1.parent != p2.parent + assert p1.parent.parent == tmp_output_dir + assert p2.parent.parent == tmp_output_dir + assert (p1.parent / "output.mml").read_text(encoding="utf-8") == mml + assert (p2.parent / "output.mml").read_text(encoding="utf-8") == mml + + # Ensure the directory follows the expected timestamp pattern. import re - pattern = re.compile(r"^output_\d{8}_\d{6}_\d{3}\.wav$") - assert pattern.match(p1.name) - assert pattern.match(p2.name) + pattern = re.compile(r"^\d{8}_\d{6}_\d{3}$") + assert pattern.match(p1.parent.name) + assert pattern.match(p2.parent.name) -- cgit v1.2.3