Exemplo n.º 1
0
def test_get_all_notes(scale, note_range, expected):
    assert (get_all_notes(scale,
                          Note.to_list(note_range)) == Note.to_list(expected))
Exemplo n.º 2
0
def test_adapt_chord_to_sequencer(chord, note_range, expected):
    assert (adapt_chord_to_sequencer(
        chord, Note.to_list(note_range)) == Note.to_list(expected))
Exemplo n.º 3
0
def test_chord_instanciation_with_inversion():
    normal = Chord("A4", "power", inversion=0)
    inverted = Chord("A4", "power", inversion=1)

    assert normal.notes == Note.to_list("A4,E5")
    assert inverted.notes == Note.to_list("E5,A5")
Exemplo n.º 4
0
def test_chord_instanciation(root_note, chord_name, result_notes):
    chord = Chord(root_note, chord_name)

    assert chord.notes == Note.to_list(result_notes)
Exemplo n.º 5
0
    chord = Chord(root_note, chord_name, base_note=base_note)

    assert chord.base_note == Note(base_note)
    assert repr(chord) == f"<Chord {expected_str}>"


def test_chord_instanciation_with_inversion():
    normal = Chord("A4", "power", inversion=0)
    inverted = Chord("A4", "power", inversion=1)

    assert normal.notes == Note.to_list("A4,E5")
    assert inverted.notes == Note.to_list("E5,A5")


@mark.parametrize("root_note,chord_name,extensions,expected_str,expected_notes", [
    ("A2", "power",    ("5",),        "A2power",            Note.to_list("A2,E3")),
    ("A2", "power",    ("4",),        "A2power add4",       Note.to_list("A2,D3,E3")),
    ("B2", "min",      ("9a",),       "B2min add9a",        Note.to_list("B2,D3,F#3,C##4")),
    ("D3", "maj7",     ("11", "13d"), "D3maj7 add11add13d", Note.to_list("D3,F#3,A3,C#4,G4,Bbb4")),
    ("F4", "min maj7", ("14dd",),     "F4min maj7 add14dd", Note.to_list("F4,Ab4,C5,E5,Ebbb6"))
])
def test_chord_instanciation_with_extensions(root_note, chord_name, extensions, expected_str, expected_notes):
    chord = Chord(root_note, chord_name, extensions=extensions)

    assert repr(chord) == f"<Chord {expected_str}>"

    assert chord.notes == expected_notes


@mark.parametrize("inversion", [-1, 2])
def test_chord_instanciation_with_inversion_out_of_range(inversion):
Exemplo n.º 6
0
def test_scale_instanciation(root_note, scale_name, result_notes):
    scale = Scale(root_note, scale_name)

    assert scale.notes == Note.to_list(result_notes)