Ejemplo n.º 1
0
def write_groupseq(melody):
    grouping = str(input('Pauses or Pitch? 1|2: '))
    if grouping == '1':
        seq = tools.group_by_pauses(melody)
    elif grouping == '2':
        seq = tools.group_by_pitch(melody)
    else:
        from_user = str(input('Incorrect grouping method. Try again? Y|N '))
        if from_user == 'Y':
            write_groupseq(melody)
        else:
            raise SystemExit
    return tools.flatten_sequence(seq)
Ejemplo n.º 2
0
 def test_all_pauses(self):
     seq = [PAUSE, PAUSE, PAUSE]
     grouped_seq = [(PAUSE, PAUSE, PAUSE)]
     self.assertEqual(tools.group_by_pauses(seq), grouped_seq)
Ejemplo n.º 3
0
 def test_no_pauses(self):
     seq = [1, 2, 3, 1, 2, 3, 4]
     grouped_seq = [(1, 2, 3, 1, 2, 3, 4)]
     self.assertEqual(tools.group_by_pauses(seq), grouped_seq)
Ejemplo n.º 4
0
 def test_pause_grouping(self):
     seq = [1, 2, PAUSE, 1, PAUSE, 1, 1, 3, PAUSE, 3]
     grouped_seq = [(1, 2), (PAUSE, 1), (PAUSE, 1, 1, 3), (PAUSE, 3)]
     self.assertEqual(tools.group_by_pauses(seq), grouped_seq)