3 # © Copyright 2021-2022, Scott Gasch
5 """chord parser unittest"""
9 from music.chords import ChordParser
12 import unittest_utils as uu
15 class TestChordParder(unittest.TestCase):
16 def test_with_known_correct_answers(self):
18 'D': "D (major)\nroot=D\n+ major 3rd (4) => F#\n+ perfect 5th (7) => A\n",
19 'DM': "D (major)\nroot=D\n+ major 3rd (4) => F#\n+ perfect 5th (7) => A\n",
20 'Dmaj': "D (major)\nroot=D\n+ major 3rd (4) => F#\n+ perfect 5th (7) => A\n",
21 'D major': "D (major)\nroot=D\n+ major 3rd (4) => F#\n+ perfect 5th (7) => A\n",
25 for chord_name, expected_answer in expected_answers.items():
27 expected_answer, cp.parse(chord_name).__repr__(), f'Failed for {chord_name}'
31 if __name__ == '__main__':
32 bootstrap.initialize(unittest.main)()