def test_tempotools_rewrite_integer_tempo_01():

    pairs = tempotools.rewrite_integer_tempo(58, 8, 8)

    assert pairs == [(Fraction(1, 2), Fraction(29, 1)),
        (Fraction(1, 1), Fraction(58, 1)),
        (Fraction(3, 2), Fraction(87, 1)),
        (Fraction(2, 1), Fraction(116, 1))]
def test_tempotools_rewrite_integer_tempo_03():

    pairs = tempotools.rewrite_integer_tempo(52, 4, 4)

    assert pairs == [(Fraction(1, 2), Fraction(26, 1)),
        (Fraction(3, 4), Fraction(39, 1)),
        (Fraction(1, 1), Fraction(52, 1)),
        (Fraction(3, 2), Fraction(78, 1)),
        (Fraction(2, 1), Fraction(104, 1))]
def report_integer_tempo_rewrite_pairs(integer_tempo,
    maximum_numerator=None, maximum_denominator=None):
    '''Report `integer_tempo` rewrite pairs.

    Allow no tempo less than half `integer_tempo` or
    greater than double `integer_tempo`:

    ::

        >>> tempotools.report_integer_tempo_rewrite_pairs(
        ...   58, maximum_numerator=8, maximum_denominator=8)
        2:1     29
        1:1     58
        2:3     87
        1:2     116

    With more lenient numerator and denominator:

    ::

        >>> tempotools.report_integer_tempo_rewrite_pairs(
        ...     58, maximum_numerator=30, maximum_denominator=30)
        2:1     29
        29:15   30
        29:16   32
        29:17   34
        29:18   36
        29:19   38
        29:20   40
        29:21   42
        29:22   44
        29:23   46
        29:24   48
        29:25   50
        29:26   52
        29:27   54
        29:28   56
        1:1     58
        29:30   60
        2:3     87
        1:2     116

    Returns none.
    '''
    from abjad.tools import tempotools

    pairs = tempotools.rewrite_integer_tempo(
      integer_tempo, maximum_numerator=maximum_numerator, maximum_denominator=maximum_denominator)

    for multiplier, tempo in pairs:
      print '{}\t{}'.format(multiplier.prolation_string, tempo)
def test_tempotools_rewrite_integer_tempo_02():

    pairs = tempotools.rewrite_integer_tempo(58, 30, 30)

    assert pairs == [(Fraction(1, 2), Fraction(29, 1)),
        (Fraction(15, 29), Fraction(30, 1)),
        (Fraction(16, 29), Fraction(32, 1)),
        (Fraction(17, 29), Fraction(34, 1)),
        (Fraction(18, 29), Fraction(36, 1)),
        (Fraction(19, 29), Fraction(38, 1)),
        (Fraction(20, 29), Fraction(40, 1)),
        (Fraction(21, 29), Fraction(42, 1)),
        (Fraction(22, 29), Fraction(44, 1)),
        (Fraction(23, 29), Fraction(46, 1)),
        (Fraction(24, 29), Fraction(48, 1)),
        (Fraction(25, 29), Fraction(50, 1)),
        (Fraction(26, 29), Fraction(52, 1)),
        (Fraction(27, 29), Fraction(54, 1)),
        (Fraction(28, 29), Fraction(56, 1)),
        (Fraction(1, 1), Fraction(58, 1)),
        (Fraction(30, 29), Fraction(60, 1)),
        (Fraction(3, 2), Fraction(87, 1)),
        (Fraction(2, 1), Fraction(116, 1))]