def test_the_relative_major_is_3_semitones_above(note_str, expected_relative_major): note = Note(note_str) relative_major = note.relative_major assert relative_major == Note(expected_relative_major)
def test_can_be_substracted(note_str, note_2_str, expected_substraction): note = Note(note_str) note_2 = Note(note_2_str) substraction = note - note_2 assert substraction[0] == approx(expected_substraction[0], rel=0.001) assert substraction[1] == approx(expected_substraction[1], rel=0.001)
def test_can_be_created_from_Music21_name(note_21_name, expected_pychord_value): note = Note.from_Music21_name(note_21_name) pychord_value = note.pychord_value assert pychord_value == expected_pychord_value
def test_returns_its_corresponding_x_y_in_5th_circle( note_str, expected_x_y_in_5th_circle): note = Note(note_str) position = note.x_y_in_5th_circle assert position[0] == approx(expected_x_y_in_5th_circle[0], rel=0.001) assert position[1] == approx(expected_x_y_in_5th_circle[1], rel=0.001)
def slash_bass(self): return Note(self.pychord_chord.on or self.pychord_chord.root)
def note_in_5h_circle(self): root_note = Note(self.pychord_chord.root) return root_note if self.mode != ChordMode.Minor else root_note.relative_major
def root(self): return Note(self.pychord_chord.root)
def test_returns_its_corresponding_angle_in_5th_circle( note_str, expected_angle_in_5th_circle): note = Note(note_str) assert note.angle_in_5th_circle_degrees == expected_angle_in_5th_circle
def test_returns_its_corresponding_position_in_5th_circle( note_str, expected_position_in_5th_circle): note = Note(note_str) assert note.position_in_5th_circle == expected_position_in_5th_circle
def test_has_a_string_representation(note_str): note = Note(note_str) assert str(note) == note_str
def test_can_be_created_from_pychord_value(pychord_value, expected_note): note = Note.from_pychord_value(pychord_value) assert note == Note(expected_note)
def test_stores_its_corresponding_pychord_value(note_str, expected_pychord_value): note = Note(note_str) assert note.pychord_value == expected_pychord_value
def test_notes_that_are_different_are_detected(note_str, note_str_2): note = Note(note_str) note2 = Note(note_str_2) assert note != note2
def test_notes_that_are_equal_are_detected(note_str, note_str_2): note = Note(note_str) note2 = Note(note_str_2) assert note == note2