def test_equality_an2(): n1 = m21.note.Note(nameWithOctave='D5', quarterLength=2) n1.id = 344 n1.tie = m21.tie.Tie('stop') n2 = m21.note.Note(nameWithOctave='D5', quarterLength=2) n2.id = 344 n2.tie = m21.tie.Tie('stop') #create annotated note anote1 = nlin.AnnotatedNote(n1, [], []) anote2 = nlin.AnnotatedNote(n2, [], []) assert (anote1 == anote2) assert (repr(anote1) == repr(anote2))
def test_pitches_diff1(): n1 = m21.note.Note(nameWithOctave='D#5', quarterLength=1) n2 = m21.note.Note(nameWithOctave='D--5', quarterLength=1) #create AnnotatedNotes note1 = nlin.AnnotatedNote(n1, [], []) note2 = nlin.AnnotatedNote(n2, [], []) #pitches to compare pitch1 = note1.pitches[0] pitch2 = note2.pitches[0] #compare op_list, cost = scl.pitches_diff(pitch1, pitch2, note1, note2, (0, 0)) assert (cost == 1) assert (op_list == [("accidentedit", note1, note2, 1, (0, 0))])
def test_pitches_diff2(): n1 = m21.note.Note(nameWithOctave='E5', quarterLength=2) n2 = m21.note.Note(nameWithOctave='D--5', quarterLength=1) note1 = nlin.AnnotatedNote(n1, [], []) note2 = nlin.AnnotatedNote(n2, [], []) #pitches to compare pitch1 = note1.pitches[0] pitch2 = note2.pitches[0] #compare op_list, cost = scl.pitches_diff(pitch1, pitch2, note1, note2, (0, 0)) assert (cost == 2) assert (len(op_list) == 2) assert (("accidentins", None, note2, 1, (0, 0)) in op_list) assert (("pitchnameedit", note1, note2, 1, (0, 0)) in op_list)
def test_pitches_diff4(): n1 = m21.note.Note(nameWithOctave='D5', quarterLength=2) n1.tie = m21.tie.Tie('stop') n2 = m21.note.Note(nameWithOctave='D#5', quarterLength=3) n2.tie = m21.tie.Tie('stop') note1 = nlin.AnnotatedNote(n1, [], []) note2 = nlin.AnnotatedNote(n2, [], []) #pitches to compare pitch1 = note1.pitches[0] pitch2 = note2.pitches[0] #compare op_list, cost = scl.pitches_diff(pitch1, pitch2, note1, note2, (0, 0)) assert (cost == 1) assert (len(op_list) == 1) assert (("accidentins", None, note2, 1, (0, 0)) in op_list)
def test_pitches_diff3(): n1 = m21.note.Note(nameWithOctave='D--5', quarterLength=2) n1.tie = m21.tie.Tie('stop') n2 = m21.note.Rest(quarterLength=0.5) note1 = nlin.AnnotatedNote(n1, [], []) note2 = nlin.AnnotatedNote(n2, [], []) #pitches to compare pitch1 = note1.pitches[0] pitch2 = note2.pitches[0] #compare op_list, cost = scl.pitches_diff(pitch1, pitch2, note1, note2, (0, 0)) assert (cost == 3) assert (len(op_list) == 3) assert (("accidentdel", note1, None, 1, (0, 0)) in op_list) assert (("pitchtypeedit", note1, note2, 1, (0, 0)) in op_list) assert (("tiedel", note1, None, 1, (0, 0)) in op_list)
def test_annotNote1(): n1 = m21.note.Note(nameWithOctave='D#5', quarterLength=1) n1.id = 344 #create annotated note anote = nlin.AnnotatedNote(n1, [], []) assert (anote.__repr__() == "[('D5', 'sharp', False)],4,0,[],[],344") assert (str(anote) == "[D5sharp]4")
def test_annotNote3(): n1 = m21.note.Note(nameWithOctave='D5', quarterLength=2) n1.id = 344 n1.tie = m21.tie.Tie('stop') #create annotated note anote = nlin.AnnotatedNote(n1, [], []) assert (anote.__repr__() == "[('D5', 'None', True)],2,0,[],[],344") assert (str(anote) == "[D5T]2")
def test_annotNote2(): n1 = m21.note.Note(nameWithOctave='E#5', quarterLength=0.5) n1.id = 344 #create annotated note anote = nlin.AnnotatedNote(n1, ["start"], ["start"]) assert (anote.__repr__() == "[('E5', 'sharp', False)],4,0,['start'],['start'],344") assert (str(anote) == "[E5sharp]4BsrTsr")
def test_noteNode_size4(): n1 = m21.note.Note(nameWithOctave='D5') n2 = m21.note.Note(nameWithOctave='F#5') n2.tie = m21.tie.Tie('stop') n3 = m21.note.Note(nameWithOctave='G#5') d = m21.duration.Duration(1.75) chord = m21.chord.Chord([n1, n2, n3], duration=d) #create annotated note anote = nlin.AnnotatedNote(chord, [], []) assert (anote.notation_size() == 12)
def test_noteNode_size3(): d = m21.duration.Duration(1.5) n1 = m21.chord.Chord(['D', 'F#', 'A'], duration=d) #create annotated note anote = nlin.AnnotatedNote(n1, [], []) assert (anote.notation_size() == 7)
def test_annotNote_size2(): n1 = m21.note.Note(nameWithOctave='D#5', quarterLength=1.5) n1.tie = m21.tie.Tie('stop') #create annotated note anote = nlin.AnnotatedNote(n1, [], []) assert (anote.notation_size() == 4)