@@ -86,7 +86,7 @@ class MusicModelTests(unittest.TestCase):
|
||||
result = generator.arrange.generate.arrange_document(source, part, rhythms=tests.rhythm_fixtures.library())
|
||||
generator.model.validate_document(result)
|
||||
measures = result['staves'][0]['measures']
|
||||
self.assertEqual(sum(bool(m.get('section_label')) for m in measures), 7)
|
||||
self.assertEqual([m['section_label'] for m in measures if m.get('section_label')], ['Rhythm Lead-in', 'Vocal Melody', 'Guitar Melody', 'Acoustic Solo', 'Electric Solo', 'Vocal Melody', 'Ending'])
|
||||
self.assertFalse(measures[-1]['harmonies'])
|
||||
self.assertTrue(any(h for m in measures[:-1] for h in m['harmonies']))
|
||||
self.assertFalse(any('chord_optional' in h for m in measures for h in m['harmonies']))
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ class PartGenerationTests(unittest.TestCase):
|
||||
generator.model.validate_document(result)
|
||||
for measure in result['staves'][0]['measures']:
|
||||
events = measure['voices'][0]['notes']
|
||||
if measure.get('section_label') in ('Rhythm Lead-in', 'Guitar Melody', 'Guitar Solo'):
|
||||
if measure.get('section_label') in ('Rhythm Lead-in', 'Guitar Melody', 'Acoustic Solo', 'Electric Solo'):
|
||||
continue
|
||||
self.assert_complete_measure(measure)
|
||||
sounding = [n for n in events if n['pitches']]
|
||||
|
||||
@@ -8,6 +8,7 @@ import shutil
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
import generator.arrange.form
|
||||
import generator.arrange.generate
|
||||
import generator.engraving.cache
|
||||
import generator.engraving.fonts
|
||||
@@ -152,7 +153,8 @@ class ScaleOutputTests(unittest.TestCase):
|
||||
before = copy.deepcopy(source)
|
||||
warnings = io.StringIO()
|
||||
with contextlib.redirect_stdout(warnings):
|
||||
report = generator.scales.mapping.annotate(source, [generator.scales.timeline.Solo(0, 12, 'Guitar Solo')], tests.scale_fixtures.library(), 'fixture.xml')
|
||||
report = generator.scales.mapping.annotate(source, [generator.scales.timeline.Solo(0, 12, 'Acoustic Solo')], tests.scale_fixtures.library(), 'fixture.xml')
|
||||
self.assertTrue(report.startswith('Acoustic: Acoustic Solo\n'))
|
||||
self.assertIn('fixture.xml, Acoustic, source measure 3', warnings.getvalue())
|
||||
self.assertIn('No exact match within the permitted catalog', report)
|
||||
self.assertIn('Parent degree: 1; chord-root mode: C Ionian', report)
|
||||
@@ -166,7 +168,7 @@ class ScaleOutputTests(unittest.TestCase):
|
||||
def test_layout_keeps_exact_offsets_continuations_and_uniform_size(self):
|
||||
source = tests.test_musicxml.parse(tests.test_accompaniment.xml_bars([tests.test_musicxml.xml_note()] * 40))
|
||||
staff = source['staves'][0]
|
||||
staff['measures'][0]['section_label'] = 'Guitar Solo'
|
||||
staff['measures'][0]['section_label'] = 'Electric Solo'
|
||||
staff['scale_spans'] = [{'id': f'scale-{i}', 'start': generator.model.rational(a), 'end': generator.model.rational(b), 'label': label, 'matched': True} for i, (a, b, label) in enumerate(((0, fractions.Fraction(3, 2), 'C Ionian'), (fractions.Fraction(3, 2), 60, 'D Harmonic Minor')), 1)]
|
||||
fonts = generator.engraving.fonts.Fonts(pathlib.Path('package/assets/fonts/petaluma'))
|
||||
layout = generator.engraving.layout.layout_score(source, generator.engraving.types.Style(), fonts)
|
||||
@@ -174,6 +176,7 @@ class ScaleOutputTests(unittest.TestCase):
|
||||
self.assertEqual(len({s.scale for s in systems}), 1)
|
||||
self.assertTrue(all(len(p.systems) == 2 for p in layout.pages[:-1]))
|
||||
self.assertGreater(len(systems), 2)
|
||||
self.assertEqual([p.value for s in systems for p in s.primitives if p.role == 'section'], ['Electric Solo'])
|
||||
for system in systems:
|
||||
expected = [s['label'] for s in staff['scale_spans'] if generator.model.fraction(s['start']) < system.end and generator.model.fraction(s['end']) > system.start]
|
||||
self.assertEqual([p.value for p in system.primitives if p.role == 'scale'], expected)
|
||||
@@ -181,9 +184,12 @@ class ScaleOutputTests(unittest.TestCase):
|
||||
def test_only_soloing_part_is_annotated_without_revoicing(self):
|
||||
content = '<harmony><root><root-step>C</root-step></root><kind>major</kind></harmony>' + tests.test_musicxml.xml_note()
|
||||
source = tests.test_musicxml.parse(tests.test_musicxml.xml_score(content))
|
||||
roles = {'acoustic': ('slash', 'accompaniment'), 'electric': ('rest', 'slash'), 'vocal': ('rest', 'rest')}
|
||||
for part in ('acoustic', 'electric', 'vocal'):
|
||||
before = generator.arrange.generate.arrange_document(source, part, rhythms=tests.rhythm_fixtures.library())
|
||||
result = generator.arrange.generate.arrange_document(source, part, rhythms=tests.rhythm_fixtures.library(), scales=tests.scale_fixtures.library())
|
||||
sections = generator.arrange.form.full_arrangement_sections(source['staves'][0]['measures'], part)
|
||||
self.assertEqual([(s.label, s.role) for s in sections[3:5]], list(zip(('Acoustic Solo', 'Electric Solo'), roles[part])))
|
||||
spans = result['staves'][0].pop('scale_spans', [])
|
||||
self.assertEqual(result, before)
|
||||
self.assertEqual(len(spans), int(part != 'vocal'))
|
||||
|
||||
Reference in New Issue
Block a user