def test_valid_addition_compound_minor(): n = Note.from_note_string('C4') i = Interval.from_interval_string('m14') res = n + i assert (res.pitch == 'B') and (res.octave == 5) and (res.accidental == 'b')
def test_manual_interval_creation_incorrect_interval_combination(): with pytest.raises(ValueError): i = Interval('P', 6)
def test_interval_creation_incorrect_interval_type(): with pytest.raises(ValueError): i = Interval.from_interval_string('asd5')
def test_manual_interval_creation_incorrect_interval_type(): with pytest.raises(ValueError): i = Interval('asd', 5)
def test_manual_interval_creation_incorrect_size_float_value(): with pytest.raises(TypeError): i = Interval('M', 6.5)
def test_interval_creation_correct_interval_augmented(): i = Interval.from_interval_string('aug5') assert i.interval_type == 'aug'
def test_interval_creation_correct_size(): i = Interval.from_interval_string('aug5') assert i.size == 5
def test_interval_creation_incorrect_size_string(): with pytest.raises(TypeError): i = Interval.from_interval_string('Mbutts')
def test_manual_interval_creation_incorrect_interval_combination(): with pytest.raises(ValueError): i = Interval.from_interval_string('P6')
def test_fifth_addition_over_octave(): n = Note.from_note_string('A4') i = Interval.from_interval_string('P5') res = n + i assert (res.pitch == 'E') and (res.octave == 5) and (res.accidental is None)
def test_interval_creation_incorrect_size_float_value(): with pytest.raises(TypeError): i = Interval.from_interval_string('M6.5')
def test_small_addition_over_octave(): n = Note.from_note_string('B4') i = Interval.from_interval_string('m2') res = n + i assert (res.pitch == 'C') and (res.octave == 5) and (res.accidental is None)
def test_valid_addition_compound_diminished_octave(): n = Note.from_note_string('C4') i = Interval.from_interval_string('dim8') res = n + i assert (res.pitch == 'C') and (res.octave == 5) and (res.accidental == 'b')
def test_valid_addition_compound_augmented(): n = Note.from_note_string('C4') i = Interval.from_interval_string('aug13') res = n + i assert (res.pitch == 'A') and (res.octave == 5) and (res.accidental == '#')
def test_interval_creation_correct_interval_minor(): i = Interval.from_interval_string('m6') assert i.interval_type == 'm'
def test_simple_interval_string(): i = Interval('M', 7) assert i.__str__() == 'M7'
def test_interval_creation_correct_interval_diminished(): i = Interval.from_interval_string('dim5') assert i.interval_type == 'dim'
def test_manual_interval_creation_correct_interval_diminished(): i = Interval('dim', 5) assert i.interval_type == 'dim'
def test_interval_creation_correct_size_two_digit(): i = Interval.from_interval_string('aug15') assert i.size == 15
def test_manual_interval_creation_correct_interval_augmented(): i = Interval('aug', 5) assert i.interval_type == 'aug'
def test_creation_all_valid_intervals_list(): for x in Interval.VALID_INTERVAL_TYPES: i = Interval.from_interval_string(x)
def test_manual_interval_creation_correct_interval_perfect(): i = Interval('P', 5) assert i.interval_type == 'P'
def test_manual_interval_creation_incorrect_size_negative(): with pytest.raises(ValueError): i = Interval('M', -5)
def test_manual_interval_creation_correct_size_whole_number(): i = Interval('aug', 5) assert i.size == 5
def test_manual_interval_creation_incorrect_size_string(): with pytest.raises(TypeError): i = Interval('M', 'butts')
def test_manual_interval_creation_correct_size_two_digit(): i = Interval('aug', 15) assert i.size == 15
def test_manual_interval_creation_correct_interval_minor(): i = Interval('m', 6) assert i.interval_type == 'm'
def test_manual_interval_creation_correct_size_as_string(): i = Interval('aug', '7') assert i.size == 7
def test_interval_creation_incorrect_size_negative(): with pytest.raises(ValueError): i = Interval.from_interval_string('M-5')
def test_valid_addition_simple_major_second(): n = Note.from_note_string('C4') i = Interval.from_interval_string('M2') res = n + i assert (res.pitch == 'D') and (res.octave == 4) and (res.accidental == None)