def test_dim6(self): chords = find_chords_from_notes(["Eb", "Gb", "A", "C"]) self.assertEqual(chords, [ Chord("Ebdim7"), Chord("Gbdim7/Eb"), Chord("Adim7/Eb"), Chord("Cdim7/Eb") ])
def test_idempotence(self): for _ in range(2): chords = find_chords_from_notes(["Eb", "Gb", "A", "C"]) self.assertEqual(chords, [ Chord("Ebdim7"), Chord("Gbdim7/Eb"), Chord("Adim7/Eb"), Chord("Cdim7/Eb") ]) self.assertEqual(chords[0].components(visible=True), ["Eb", "Gb", "A", "C"])
def _assert_chords(self, notes, expected_chords): """ Validates that the specified notes translated to the expected chords. :param notes: The notes of the chord, either as a list of strings, e.g. ["G", "C", "D"] or a string, e.g. "G C D" :param expected_chords: the chords that the notes could translate to, specified as a list of strings, e.g. [ "Gsus4", "Csus2/G" ], or a single string if only one chord expected. """ if isinstance(notes, str): notes = notes.split() c0 = find_chords_from_notes(notes) if isinstance(expected_chords, str): expected_chords = [expected_chords] self.assertEqual(c0, [Chord(c) for c in expected_chords])
def test_sus4(self): chords = find_chords_from_notes(["G", "C", "D"]) self.assertEqual(chords, [Chord("Gsus4"), Chord("Csus2/G")])
def test_dim(self): chords = find_chords_from_notes(["Eb", "Gb", "A"]) self.assertEqual(chords, [Chord("Ebdim")])
def test_major_on_fifth(self): chords = find_chords_from_notes(["B", "E", "G#"]) self.assertEqual(chords, [Chord("E/B")])
def test_major_on_third(self): chords = find_chords_from_notes(["F#", "A", "D"]) self.assertEqual(chords, [Chord("D/F#")])
def test_major(self): chords = find_chords_from_notes(["C", "E", "G"]) self.assertEqual(chords, [Chord("C")])
def test_minor_add4(self): chords = find_chords_from_notes(["C", "Eb", "F", "G"]) self.assertEqual(chords, [Chord("Cmadd4")])
def test_m7dim5(self): chords = find_chords_from_notes(["F#", "A", "C", "E"]) self.assertEqual(chords, [Chord("F#m7-5"), Chord("Am6/F#")])
def test_add9(self): chords = find_chords_from_notes(["C", "E", "G", "D"]) self.assertEqual(chords, [Chord("Cadd9")])
def test_aug(self): chords = find_chords_from_notes(["F", "A", "Db"]) self.assertEqual( chords, [Chord("Faug"), Chord("Aaug/F"), Chord("Dbaug/F")])