Fixed bug with subdivisions and added tests
This commit is contained in:
@ -87,3 +87,20 @@ def test_subdivisions(pattern: str, expected: list):
|
||||
def test_repeats(pattern: str, expected: list):
|
||||
assert zparse(pattern).notes() == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"pattern,expected",
|
||||
[
|
||||
("0 [0 2] 0", [0.25, 0.125, 0.125, 0.25, 0.25, 0.125, 0.125, 0.25, 0.25, 0.125, 0.125, 0.25]),
|
||||
("w 0 [0 [1 [2 3]] 0] 9", [1.0, 0.3333333333333333, 0.16666666666666666, 0.08333333333333333, 0.08333333333333333, 0.3333333333333333, 1.0, 1.0, 0.3333333333333333, 0.16666666666666666, 0.08333333333333333, 0.08333333333333333]),
|
||||
("1.0 0 [[2 3] [3 5]] 4", [1.0, 0.25, 0.25, 0.25, 0.25, 1.0, 1.0, 0.25, 0.25, 0.25, 0.25, 1.0]),
|
||||
("2.0 0 [1[2[3[4 5]6]7]8] 9", [2.0, 0.6666666666666666, 0.2222222222222222, 0.07407407407407407, 0.037037037037037035, 0.037037037037037035, 0.07407407407407407, 0.2222222222222222, 0.6666666666666666, 2.0, 2.0, 0.6666666666666666])
|
||||
|
||||
]
|
||||
)
|
||||
def test_looping_durations(pattern: str, expected: list):
|
||||
parsed = zparse(pattern)
|
||||
durations = []
|
||||
for i in range(12):
|
||||
durations.append(parsed[i].duration)
|
||||
assert durations == expected
|
||||
|
||||
Reference in New Issue
Block a user