Data File Mappings
ci / checks (push) Successful in 2h3m59s

This commit is contained in:
khodowany
2026-09-16 23:55:09 -05:00
parent 079c024ca9
commit aa1273b07d
13 changed files with 291 additions and 271 deletions
+12 -5
View File
@@ -51,8 +51,11 @@ class GuitarPracticeTests(unittest.TestCase):
voicing = find_playable_voicing('C7')
self.assertEqual(len(voicing), 4)
self.assertTrue(all(p.fret == 1 for p in voicing))
def test_current_catalogue_all_keys_preserve_exact_voicings(self):
source = practice_document(load_musicxml(Path('data/practice/chord/01_three_note_shell_voicings/01-cycles.xml')))
def test_all_keys_preserve_exact_voicings_and_adjust_g_register(self):
harmony = '<harmony><root><root-step>G</root-step></root><kind>dominant</kind></harmony>'
content = xml_note('G', 2, 'half') + xml_note('B', 2, 'half', prefix='<chord/>') + xml_note('F', 2, 'half', prefix='<chord/>', octave=5)
content += xml_note('A', 2, 'half', alter=-1, octave=3) + xml_note('G', 2, 'half', alter=-1, prefix='<chord/>') + xml_note('C', 2, 'half', prefix='<chord/>', octave=5)
source = practice_document(parse(xml_score(harmony + content)))
original = copy.deepcopy(source)
for key in TARGET_KEYS:
with self.subTest(key=key):
@@ -209,11 +212,15 @@ class GuitarPracticeTests(unittest.TestCase):
self.assertEqual(list(output.iterdir()), [output / 'last-good'])
def test_all_practice_types_require_twelve_deterministic_variants(self):
with tempfile.TemporaryDirectory() as temp:
output = Path(temp)
self.assertEqual(generate_practice_scores(Path('data/practice'), output), 48)
source, output = Path(temp) / 'source', Path(temp) / 'output'
for practice_type in ('chord', 'melody'):
path = source / practice_type / '001_lesson' / '001-exercise.xml'
path.parent.mkdir(parents=True)
path.write_text(xml_score(xml_note()), encoding='utf-8')
self.assertEqual(generate_practice_scores(source, output), 24)
validate_practice_variants(output)
first = {p.relative_to(output): p.read_bytes() for p in output.rglob('*.json')}
generate_practice_scores(Path('data/practice'), output)
generate_practice_scores(source, output)
self.assertEqual(first, {p.relative_to(output): p.read_bytes() for p in output.rglob('*.json')})
next((output / 'chord').rglob('g.json')).unlink()
with self.assertRaisesRegex(ValueError, 'chord practice generator drift'):