def test_sequencetools_is_monotonically_increasing_sequence_01(): r'''True when the elements in l increase monotonically. ''' l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] assert sequencetools.is_monotonically_increasing_sequence(l) l = [0, 1, 2, 3, 3, 3, 3, 3, 3, 3] assert sequencetools.is_monotonically_increasing_sequence(l)
def test_sequencetools_is_monotonically_increasing_sequence_02(): r'''False when the elements in l do not increase monotonically. ''' l = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] assert not sequencetools.is_monotonically_increasing_sequence(l) l = [3, 3, 3, 3, 3, 3, 3, 2, 1, 0] assert not sequencetools.is_monotonically_increasing_sequence(l)
def __init__(self, sequence): from abjad.tools import quantizationtools q_event_classes = (quantizationtools.PitchedQEvent, quantizationtools.SilentQEvent) assert 1 < len(sequence) assert all(isinstance(q_event, q_event_classes) for q_event in sequence[:-1]) assert isinstance(sequence[-1], quantizationtools.TerminalQEvent) assert sequencetools.is_monotonically_increasing_sequence(x.offset for x in sequence) assert 0 <= sequence[0].offset self._sequence = tuple(sequence)
def test_sequencetools_is_monotonically_increasing_sequence_03(): r'''True when l is empty. ''' l = [] assert sequencetools.is_monotonically_increasing_sequence(l)