Fixed Subdivision in normal repeats

This commit is contained in:
2023-02-26 22:32:50 +02:00
parent da020cc3a2
commit 9e37bd366f
2 changed files with 18 additions and 0 deletions

View File

@ -91,6 +91,21 @@ def test_subdivisions(pattern: str, expected: list):
def test_repeats(pattern: str, expected: list):
assert collect(zparse(pattern),len(expected)*2,"note") == expected*2
@pytest.mark.parametrize(
"pattern,expected",
[
("[: 3 [2 4] :]", [0.25, 0.125, 0.125, 0.25, 0.125, 0.125]),
("[: 1 [2 [5 6]] 3 [2 4] :]", [0.25, 0.125, 0.0625, 0.0625, 0.25, 0.125, 0.125, 0.25, 0.125, 0.0625, 0.0625, 0.25, 0.125, 0.125]),
("(: 3 [2 4] :)", [0.25, 0.125, 0.125, 0.25, 0.125, 0.125]),
("(: 1 [2 [5 6]] 3 [2 4] :)", [0.25, 0.125, 0.0625, 0.0625, 0.25, 0.125, 0.125, 0.25, 0.125, 0.0625, 0.0625, 0.25, 0.125, 0.125]),
("(3 [2 4]):2", [0.25, 0.125, 0.125, 0.25, 0.125, 0.125]),
("(1 [2 [5 6]] 3 [2 4]):2", [0.25, 0.125, 0.0625, 0.0625, 0.25, 0.125, 0.125, 0.25, 0.125, 0.0625, 0.0625, 0.25, 0.125, 0.125]),
]
)
def test_repeat_durations(pattern: str, expected: list):
assert collect(zparse(pattern),len(expected)*2,"duration") == expected*2
@pytest.mark.parametrize(
"pattern,expected",
[