Fixed Subdivision in normal repeats
This commit is contained in:
@ -91,6 +91,21 @@ def test_subdivisions(pattern: str, expected: list):
|
|||||||
def test_repeats(pattern: str, expected: list):
|
def test_repeats(pattern: str, expected: list):
|
||||||
assert collect(zparse(pattern),len(expected)*2,"note") == expected*2
|
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(
|
@pytest.mark.parametrize(
|
||||||
"pattern,expected",
|
"pattern,expected",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -1097,6 +1097,9 @@ class RepeatedSequence(Sequence):
|
|||||||
yield from item.evaluate_tree(self.local_options, True)
|
yield from item.evaluate_tree(self.local_options, True)
|
||||||
elif isinstance(item, RepeatedSequence):
|
elif isinstance(item, RepeatedSequence):
|
||||||
yield item
|
yield item
|
||||||
|
elif isinstance(item, Subdivision):
|
||||||
|
item.evaluate_values(options)
|
||||||
|
yield item
|
||||||
else:
|
else:
|
||||||
yield from item
|
yield from item
|
||||||
elif isinstance(item, Cyclic):
|
elif isinstance(item, Cyclic):
|
||||||
|
|||||||
Reference in New Issue
Block a user