# Path: bl/ugen.py
# N = _Nothing()
# 
# Path: bl/nostalgia/bcut.py
# def explode(notes, factor=2):
#     notes2 = []
#     f = factor - 1
#     for note in notes:
#         notes2.append(note)
#         for i in range(f):
#             notes2.append(N)
#     return notes2
# 
# def cut(notes, aprob=0.25, bprob=0.25):
#     size = len(notes)
#     m = size / 2
#     if random.random() <= bprob:
#         if random.random() <= 0.5:  # half chop
#             slice = _cut(notes[m:])
#             notes = notes[:m] + slice
#         else:  # quarter chop
#             s = m + m / 2
#             if random.random() <= bprob:
#                 slice = _cut(notes[s:])
#                 notes = notes[:s] + slice
#             else:
#                 slice = _cut(notes[m:s])
#                 notes = notes[:m] + slice + notes[s:]
# 
#     if random.random() <= aprob:
#         if random.random() <= 0.5:
#             slice = _cut(notes[:m])
#             notes = slice + notes[m:]
#         else:
#             s = m / 2
#             if random.random() <= bprob:
#                 slice = _cut(notes[:s])
#                 notes = slice + notes[s:]
#             else:
#                 slice = _cut(notes[s:m])
#                 notes = notes[:s] + slice + notes[m:]
#     return notes


from twisted.trial.unittest import TestCase
from bl.ugen import N
from bl.nostalgia.bcut import explode, cut



class BcutTestCase(TestCase):

    def test_explode(self):
        s = [1, 2, 3, 4]
        exploded = explode(s)
        self.assertEquals(exploded, [1, N, 2, N, 3, N, 4, N])
        exploded = explode(s, 4)
        self.assertEquals(exploded, [1, N, N, N, 2, N, N, N, 3, N, N, N, 4, N,
                                     N, N])

# Path: bl/ugen.py
# N = _Nothing()
# 
# Path: bl/nostalgia/bcut.py
# def explode(notes, factor=2):
#     notes2 = []
#     f = factor - 1
#     for note in notes:
#         notes2.append(note)
#         for i in range(f):
#             notes2.append(N)
#     return notes2
# 
# def cut(notes, aprob=0.25, bprob=0.25):
#     size = len(notes)
#     m = size / 2
#     if random.random() <= bprob:
#         if random.random() <= 0.5:  # half chop
#             slice = _cut(notes[m:])
#             notes = notes[:m] + slice
#         else:  # quarter chop
#             s = m + m / 2
#             if random.random() <= bprob:
#                 slice = _cut(notes[s:])
#                 notes = notes[:s] + slice
#             else:
#                 slice = _cut(notes[m:s])
#                 notes = notes[:m] + slice + notes[s:]
# 
#     if random.random() <= aprob:
#         if random.random() <= 0.5:
#             slice = _cut(notes[:m])
#             notes = slice + notes[m:]
#         else:
#             s = m / 2
#             if random.random() <= bprob:
#                 slice = _cut(notes[:s])
#                 notes = slice + notes[s:]
#             else:
#                 slice = _cut(notes[s:m])
#                 notes = notes[:s] + slice + notes[m:]
#     return notes


# Path: bl/nostalgia/test_bcut.py
from twisted.trial.unittest import TestCase
from bl.ugen import N
from bl.nostalgia.bcut import explode, cut




class BcutTestCase(TestCase):

    def test_explode(self):
        s = [1, 2, 3, 4]
        exploded = explode(s)
        self.assertEquals(exploded, [1, N, 2, N, 3, N, 4, N])
        exploded = explode(s, 4)
        self.assertEquals(exploded, [1, N, N, N, 2, N, N, N, 3, N, N, N, 4, N,
                                     N, N])

        s = [1, N, 2, N, N, 3, 4, N]