コード例 #1
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
コード例 #2
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
コード例 #3
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
コード例 #4
0
def test_chord_unsupported_chord_type():
    with pytest.raises(ValueError):
        Chord.build_chord(Note.from_note_string('C4'), 'V', 'doobly`')
コード例 #5
0
def test_chord_unsupported_chord_num():
    with pytest.raises(ValueError):
        Chord.build_chord(Note.from_note_string('C4'), 'VIIII', 'maj')
コード例 #6
0
def test_chord_float_tonic():
    with pytest.raises(TypeError):
        Chord.build_chord(7.2, 'IV', 'maj')
コード例 #7
0
def test_chord_int_tonic():
    with pytest.raises(TypeError):
        Chord.build_chord(4, 'IV', 'maj')
コード例 #8
0
def test_chord_str_tonic():
    with pytest.raises(TypeError):
        Chord.build_chord('Hi', 'IV', 'maj')