This commit is contained in:
khodowany
2026-10-04 15:51:18 -05:00
parent 405066eb43
commit f234dd6d51
54 changed files with 2104 additions and 330 deletions
+8 -5
View File
@@ -235,7 +235,7 @@ class EnclosureRefinement(unittest.TestCase):
class EnclosureCompositionAPI(unittest.TestCase):
def test_disable_only_removes_post_selection_ornaments(self):
def test_disable_joint_expressions_selects_a_valid_strict_alternative(self):
from generator.solo import analysis
import tests.rhythm_fixtures
doc=song(count=8,chords=('Gm7','C7','FM7','BbM7','Em7b5','A7','Dm7','Dm7'))
@@ -244,12 +244,15 @@ class EnclosureCompositionAPI(unittest.TestCase):
kwargs=dict(scales=tests.scale_fixtures.library(),sequences=tests.solo_fixtures.library(),rhythms=tests.rhythm_fixtures.library())
decorated=composer.compose(*args,**kwargs)
strict=composer.compose(*args,**kwargs,enclosures_enabled=False)
self.assertEqual(enclosures.strict(decorated).notes(),strict.notes())
self.assertEqual([p.state.home for p in decorated.phrases],[p.state.home for p in strict.phrases])
self.assertEqual([p.anchors for p in decorated.phrases],[p.anchors for p in strict.phrases])
# A jointly composed color/anticipation can change phrase selection. Its
# disabled alternative need not be the selected decorated phrase minus
# notes; both versions must retain the same form and valid sounding spans.
self.assertEqual(decorated.end,strict.end)
composer.validate(decorated)
composer.validate(strict)
self.assertTrue(harmonic.Harmony(strict.choices).evaluate(strict.notes()).valid)
self.assertTrue(all(not p.draft.enclosures for p in strict.phrases))
self.assertGreater(decorated.diagnostics["expression_candidates"],0)
self.assertGreater(sum(v['proposed'] for v in decorated.diagnostics['expression_operations'].values()),0)
self.assertTrue(all(not p.draft.expressions for p in strict.phrases))
if __name__=='__main__':unittest.main()