Skip to content

Commit

Permalink
update TestArpeggio to use KEYMAP
Browse files Browse the repository at this point in the history
  • Loading branch information
cainky committed Apr 27, 2024
1 parent faba1e1 commit 1ff09ca
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions midigen/tests/test_chord.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,12 @@ def test_equality(self):

class TestArpeggio(unittest.TestCase):
def setUp(self):
self.notes = [Note(60, 64, 100, 0), Note(62, 64, 100, 0), Note(64, 64, 100, 0)]
# Updated to use the new KEY_MAP with octaves
self.notes = [
Note(KEY_MAP["C4"], 64, 100, 0),
Note(KEY_MAP["D4"], 64, 100, 0),
Note(KEY_MAP["E4"], 64, 100, 0),
]
self.arpeggio = Arpeggio(
self.notes, delay=100, pattern=ArpeggioPattern.ASCENDING, loops=1
)
Expand All @@ -188,7 +193,11 @@ def test_get_sequential_notes(self):
sequential_notes = self.arpeggio.get_sequential_notes()
self.assertEqual(
sequential_notes,
[Note(60, 64, 100, 0), Note(62, 64, 100, 100), Note(64, 64, 100, 200)],
[
Note(KEY_MAP["C4"], 64, 100, 0),
Note(KEY_MAP["D4"], 64, 100, 100),
Note(KEY_MAP["E4"], 64, 100, 200),
],
)

def test_get_sequential_notes_ascending(self):
Expand All @@ -197,9 +206,9 @@ def test_get_sequential_notes_ascending(self):
)
sequential_notes = arpeggio.get_sequential_notes()
expected_notes = [
Note(60, 64, 100, 0),
Note(62, 64, 100, 100),
Note(64, 64, 100, 200),
Note(KEY_MAP["C4"], 64, 100, 0),
Note(KEY_MAP["D4"], 64, 100, 100),
Note(KEY_MAP["E4"], 64, 100, 200),
]
self.assertEqual(sequential_notes, expected_notes)

Expand All @@ -209,9 +218,9 @@ def test_get_sequential_notes_descending(self):
)
sequential_notes = arpeggio.get_sequential_notes()
expected_notes = [
Note(64, 64, 100, 0),
Note(62, 64, 100, 100),
Note(60, 64, 100, 200),
Note(KEY_MAP["E4"], 64, 100, 0),
Note(KEY_MAP["D4"], 64, 100, 100),
Note(KEY_MAP["C4"], 64, 100, 200),
]
self.assertEqual(sequential_notes, expected_notes)

Expand All @@ -221,11 +230,11 @@ def test_get_sequential_notes_alternating(self):
)
sequential_notes = arpeggio.get_sequential_notes()
expected_notes = [
Note(60, 64, 100, 0),
Note(62, 64, 100, 100),
Note(64, 64, 100, 200),
Note(64, 64, 100, 300),
Note(62, 64, 100, 400),
Note(60, 64, 100, 500),
Note(KEY_MAP["C4"], 64, 100, 0),
Note(KEY_MAP["D4"], 64, 100, 100),
Note(KEY_MAP["E4"], 64, 100, 200),
Note(KEY_MAP["E4"], 64, 100, 300),
Note(KEY_MAP["D4"], 64, 100, 400),
Note(KEY_MAP["C4"], 64, 100, 500),
]
self.assertEqual(sequential_notes, expected_notes)

0 comments on commit 1ff09ca

Please sign in to comment.