Ejemplo n.º 1
0
def test_double_note_add():
    c = Chord(Note.from_note_string('C4'))
    c.add_note(Note.from_note_string('E4'))
    c.add_note(Note.from_note_string('B4'))
    notes = [
        Note.from_note_string('C4'),
        Note.from_note_string('E4'),
        Note.from_note_string('B4')
    ]
    assert c.notes == notes
Ejemplo n.º 2
0
def test_simple_note_add_middle():
    c = Chord(Note.from_note_string('C4'))
    c.add_note(Note.from_note_string('E4'))
    c.add_note(Note.from_note_string('D4'))
    notes = [
        Note.from_note_string('C4'),
        Note.from_note_string('D4'),
        Note.from_note_string('E4')
    ]
    assert c.notes == notes
Ejemplo n.º 3
0
def test_multi_note_add_under():
    c = Chord(Note.from_note_string('D4'))
    c.add_note(Note.from_note_string('C4'))
    c.add_note(Note.from_note_string('B3'))
    notes = [
        Note.from_note_string('B3'),
        Note.from_note_string('C4'),
        Note.from_note_string('D4')
    ]
    assert c.notes == notes
Ejemplo n.º 4
0
def test_over_octave_chord_build():
    c = Chord.build_chord(Note.from_note_string('G4'), 'II', 'minor')
    expected = [
        Note.from_note_string('A4'),
        Note.from_note_string('C5'),
        Note.from_note_string('E5b')
    ]

    assert c.notes == expected
Ejemplo n.º 5
0
def test_simple_major_chord_build_non_tonic():
    c = Chord.build_chord(Note.from_note_string('C4'), 'V', 'major')
    expected = [
        Note.from_note_string('G4'),
        Note.from_note_string('B4'),
        Note.from_note_string('D5')
    ]

    assert c.notes == expected
Ejemplo n.º 6
0
def test_simple_minor_chord_build():
    c = Chord.build_chord(Note.from_note_string('C4'), 'I', 'minor')
    expected = [
        Note.from_note_string('C4'),
        Note.from_note_string('E4b'),
        Note.from_note_string('G4')
    ]

    assert c.notes == expected
Ejemplo n.º 7
0
def test_simple_two_note_str_add_under():
    c = Chord(Note.from_note_string('C4'))
    c.add_note(Note.from_note_string('B3'))
    assert c.__str__() == 'B3+C4'
Ejemplo n.º 8
0
def test_correct_note_list_length():
    c = Chord(Note.from_note_string('C4'))
    assert len(c.notes) == 1
Ejemplo n.º 9
0
def test_root_insert_under_same_pitch():
    c = Chord(Note.from_note_string('C4'))
    c.add_note(Note.from_note_string('C4b'))
    root = Note.from_note_string('C4b')
    assert c.root() == root
Ejemplo n.º 10
0
def test_root_insert_under():
    c = Chord(Note.from_note_string('C4'))
    c.add_note(Note.from_note_string('B3'))
    root = Note.from_note_string('B3')
    assert c.root() == root
Ejemplo n.º 11
0
def test_root_two_notes():
    c = Chord(Note.from_note_string('C4'))
    c.add_note(Note.from_note_string('E4'))
    root = Note.from_note_string('C4')
    assert c.root() == root
Ejemplo n.º 12
0
def test_root_one_note():
    c = Chord(Note.from_note_string('C4'))
    root = Note.from_note_string('C4')
    assert c.root() == root
Ejemplo n.º 13
0
def test_chord_int_tonic():
    with pytest.raises(TypeError):
        Chord.build_chord(4, 'IV', 'maj')
Ejemplo n.º 14
0
def test_incorrect_root_float():
    with pytest.raises(TypeError):
        c = Chord(7.2)
Ejemplo n.º 15
0
def test_single_chord_str():
    c = Chord(Note.from_note_string('D4'))
    assert c.__str__() == 'D4'
Ejemplo n.º 16
0
def test_chord_unsupported_chord_type():
    with pytest.raises(ValueError):
        Chord.build_chord(Note.from_note_string('C4'), 'V', 'doobly`')
Ejemplo n.º 17
0
def test_chord_unsupported_chord_num():
    with pytest.raises(ValueError):
        Chord.build_chord(Note.from_note_string('C4'), 'VIIII', 'maj')
Ejemplo n.º 18
0
def test_chord_float_tonic():
    with pytest.raises(TypeError):
        Chord.build_chord(7.2, 'IV', 'maj')
Ejemplo n.º 19
0
def test_simple_two_note_str():
    c = Chord(Note.from_note_string('C4'))
    c.add_note(Note.from_note_string('E4'))
    assert c.__str__() == 'C4+E4'
Ejemplo n.º 20
0
def test_incorrect_root_str():
    with pytest.raises(TypeError):
        c = Chord('A note!')
Ejemplo n.º 21
0
def test_correct_note_list():
    c = Chord(Note.from_note_string('C4'))
    assert c.notes == [Note.from_note_string('C4')]
Ejemplo n.º 22
0
def test_chord_str_tonic():
    with pytest.raises(TypeError):
        Chord.build_chord('Hi', 'IV', 'maj')