コード例 #1
0
def test_extract_time_signatures_05():
    container = abjad.Container(r"\time 3/4 c'2. d'2. \time 3/4 e'2. f'2.")
    with pytest.raises(ValueError):
        auxjad.inspect(container).extract_time_signatures(
            do_not_use_none=True,
            omit_repeated=True,
        )
コード例 #2
0
def test_leaves_are_tieable_02():
    leaf1 = abjad.Note(r"c'2.")
    leaf2 = abjad.Note(r"c'16")
    leaf3 = abjad.Note(r"f'''16")
    assert auxjad.inspect([leaf1, leaf2]).leaves_are_tieable()
    assert not auxjad.inspect([leaf1, leaf3]).leaves_are_tieable()
    assert not auxjad.inspect([leaf2, leaf3]).leaves_are_tieable()
コード例 #3
0
def test_leaves_are_tieable_03():
    chord1 = abjad.Chord(r"<c' e' g'>4")
    chord2 = abjad.Chord(r"<c' e' g'>16")
    chord3 = abjad.Chord(r"<f''' fs'''>16")
    assert auxjad.inspect([chord1, chord2]).leaves_are_tieable()
    assert not auxjad.inspect([chord1, chord3]).leaves_are_tieable()
    assert not auxjad.inspect([chord2, chord3]).leaves_are_tieable()
コード例 #4
0
def test_underfull_duration_01():
    container1 = abjad.Container(r"c'4 d'4 e'4 f'4")
    container2 = abjad.Container(r"c'4 d'4 e'4")
    container3 = abjad.Container(r"c'4 d'4 e'4 f'4 | c'4")
    container4 = abjad.Container(r"c'4 d'4 e'4 f'4 | c'4 d'4 e'4 f'4")
    assert auxjad.inspect(container1[:]).underfull_duration() == 0
    assert auxjad.inspect(container2[:]).underfull_duration() == 1 / 4
    assert auxjad.inspect(container3[:]).underfull_duration() == 3 / 4
    assert auxjad.inspect(container4[:]).underfull_duration() == 0
コード例 #5
0
def test_selection_is_full_02():
    container1 = abjad.Container(r"\time 4/4 c'4 d'4 e'4 f'4")
    container2 = abjad.Container(r"\time 3/4 a2. \time 2/4 r2")
    container3 = abjad.Container(r"\time 5/4 g1 ~ g4 \time 4/4 af'2")
    container4 = abjad.Container(r"\time 6/8 c'2 ~ c'8")
    assert auxjad.inspect(container1[:]).selection_is_full()
    assert auxjad.inspect(container2[:]).selection_is_full()
    assert not auxjad.inspect(container3[:]).selection_is_full()
    assert not auxjad.inspect(container4[:]).selection_is_full()
コード例 #6
0
def test_underfull_duration_04():
    container1 = abjad.Container(r"R1")
    container2 = abjad.Container(r"\time 3/4 R1*3/4 \time 2/4 r2")
    container3 = abjad.Container(r"\time 5/4 R1*5/4 \time 4/4 g''4")
    container4 = abjad.Container(r"\time 6/8 R1*1/2")
    assert auxjad.inspect(container1[:]).underfull_duration() == 0
    assert auxjad.inspect(container2[:]).underfull_duration() == 0
    assert auxjad.inspect(container3[:]).underfull_duration() == 3 / 4
    assert auxjad.inspect(container4[:]).underfull_duration() == 1 / 4
コード例 #7
0
def test_underfull_duration_02():
    container1 = abjad.Container(r"\time 4/4 c'4 d'4 e'4 f'4")
    container2 = abjad.Container(r"\time 3/4 a2. \time 2/4 r2")
    container3 = abjad.Container(r"\time 5/4 g1 ~ g4 \time 4/4 af'2")
    container4 = abjad.Container(r"\time 6/8 c'2 ~ c'8")
    assert auxjad.inspect(container1[:]).underfull_duration() == 0
    assert auxjad.inspect(container2[:]).underfull_duration() == 0
    assert auxjad.inspect(container3[:]).underfull_duration() == 1 / 2
    assert auxjad.inspect(container4[:]).underfull_duration() == 1 / 8
コード例 #8
0
def test_selection_is_full_04():
    container1 = abjad.Container(r"R1")
    container2 = abjad.Container(r"\time 3/4 R1*3/4 \time 2/4 r2")
    container3 = abjad.Container(r"\time 5/4 R1*5/4 \time 4/4 g''4")
    container4 = abjad.Container(r"\time 6/8 R1*1/2")
    assert auxjad.inspect(container1[:]).selection_is_full()
    assert auxjad.inspect(container2[:]).selection_is_full()
    assert not auxjad.inspect(container3[:]).selection_is_full()
    assert not auxjad.inspect(container4[:]).selection_is_full()
コード例 #9
0
def test_selection_is_full_01():
    container1 = abjad.Container(r"c'4 d'4 e'4 f'4")
    container2 = abjad.Container(r"c'4 d'4 e'4")
    container3 = abjad.Container(r"c'4 d'4 e'4 f'4 | c'4")
    container4 = abjad.Container(r"c'4 d'4 e'4 f'4 | c'4 d'4 e'4 f'4")
    assert auxjad.inspect(container1[:]).selection_is_full()
    assert not auxjad.inspect(container2[:]).selection_is_full()
    assert not auxjad.inspect(container3[:]).selection_is_full()
    assert auxjad.inspect(container4[:]).selection_is_full()
コード例 #10
0
def test_extract_time_signatures_03():
    container = abjad.Container(r"\time 5/8 c'4 ~ c'16 \time 3/8 d'4. e'4.")
    time_signatures = auxjad.inspect(container).extract_time_signatures()
    assert time_signatures == [
        abjad.TimeSignature((5, 8)),
        abjad.TimeSignature((3, 8)),
        None,
    ]
    time_signatures = auxjad.inspect(container).extract_time_signatures(
        do_not_use_none=True, )
    assert time_signatures == [
        abjad.TimeSignature((5, 8)),
        abjad.TimeSignature((3, 8)),
        abjad.TimeSignature((3, 8)),
    ]
コード例 #11
0
def test_selections_are_identical_13():
    container1 = abjad.Staff(r"c'4 d'4 e'4 f'4")
    container2 = abjad.Staff(r"c'4 d'4 e'4 f'4")
    abjad.piano_pedal(container1[:])
    abjad.piano_pedal(container2[:])
    selections = [container1[:], container2[:]]
    assert auxjad.inspect(selections).selections_are_identical()
コード例 #12
0
def test_extract_time_signatures_01():
    container = abjad.Container(r"\time 3/4 c'2. \time 4/4 d'1")
    time_signatures = auxjad.inspect(container).extract_time_signatures()
    assert time_signatures == [
        abjad.TimeSignature((3, 4)),
        abjad.TimeSignature((4, 4)),
    ]
コード例 #13
0
def test_selections_are_identical_10():
    container1 = abjad.Staff(r"c'4 \grace{c''4} d'4 e'4 f'4 <g' a'>2 r2")
    container2 = abjad.Staff(r"c'4 \grace{b4} d'4 e'4 f'4 <g' a'>2 r2")
    selection1 = abjad.select(container1)  # x[:] doesn't include graces
    selection2 = abjad.select(container2)
    selections = [selection1, selection2]
    assert not auxjad.inspect(selections).selections_are_identical()
コード例 #14
0
def test_extract_time_signatures_02():
    container = abjad.Container(r"\time 3/4 c'2. d'2. e'2.")
    time_signatures = auxjad.inspect(container).extract_time_signatures()
    assert time_signatures == [
        abjad.TimeSignature((3, 4)),
        None,
        None,
    ]
コード例 #15
0
def test_extract_time_signatures_06():
    container = abjad.Container(r"c'1 d'1 e'1 f'1")
    time_signatures = auxjad.inspect(container).extract_time_signatures()
    assert time_signatures == [
        abjad.TimeSignature((4, 4)),
        None,
        None,
        None,
    ]
    time_signatures = auxjad.inspect(container).extract_time_signatures(
        implicit_common_time=False, )
    assert time_signatures == [
        None,
        None,
        None,
        None,
    ]
コード例 #16
0
def test_extract_time_signatures_04():
    container = abjad.Container(r"\time 3/4 c'2. d'2. \time 3/4 e'2. f'2.")
    time_signatures = auxjad.inspect(container).extract_time_signatures()
    assert time_signatures == [
        abjad.TimeSignature((3, 4)),
        None,
        abjad.TimeSignature((3, 4)),
        None,
    ]
    time_signatures = auxjad.inspect(container).extract_time_signatures(
        omit_repeated=True, )
    assert time_signatures == [
        abjad.TimeSignature((3, 4)),
        None,
        None,
        None,
    ]
コード例 #17
0
def test_extract_time_signatures_07():
    container = abjad.Container(r"\time 4/4 c'1 d'1 e'1 f'1")
    time_signatures = auxjad.inspect(container).extract_time_signatures(
        do_not_use_none=True,
        implicit_common_time=False,
    )
    assert time_signatures == [
        abjad.TimeSignature((4, 4)),
        abjad.TimeSignature((4, 4)),
        abjad.TimeSignature((4, 4)),
        abjad.TimeSignature((4, 4)),
    ]
    container = abjad.Container(r"c'1 d'1 e'1 f'1")
    with pytest.raises(ValueError):
        time_signatures = auxjad.inspect(container).extract_time_signatures(
            do_not_use_none=True,
            implicit_common_time=False,
        )
コード例 #18
0
def test_prettify_rewrite_meter_12():
    container1 = abjad.Staff(
        r"\time 4/4 c'8 d'8 ~ d'8 e'8 c'16 d'16 ~ d'16 e'16 r4 "
        r"c'8 d'8 ~ d'8 e'8 c'16 d'16 ~ d'16 e'16 r4")
    container2 = abjad.mutate(container1).copy()
    meter = abjad.Meter((4, 4))
    abjad.mutate(container1[:]).prettify_rewrite_meter(meter)
    for measure in abjad.select(container2[:]).group_by_measure():
        abjad.mutate(measure).prettify_rewrite_meter(meter)
    selections = [container1[:], container2[:]]
    assert auxjad.inspect(selections).selections_are_identical()
コード例 #19
0
def test_leaves_are_tieable_07():
    staff = abjad.Staff(r"c'4 d'4 e'2 e'1")
    assert not auxjad.inspect(staff[:2]).leaves_are_tieable()
    assert not auxjad.inspect(staff[1:3]).leaves_are_tieable()
    assert auxjad.inspect(staff[2:4]).leaves_are_tieable()
コード例 #20
0
def test_selection_is_full_05():
    container = abjad.Container(r"\time 5/4 g''1 \time 4/4 f'1")
    with pytest.raises(ValueError):
        assert auxjad.inspect(container[:]).selection_is_full()
コード例 #21
0
def test_selection_is_full_03():
    container = abjad.Container(r"c'4 d'4 e'4 f'4")
    time_signature = abjad.TimeSignature((3, 4), partial=(1, 4))
    abjad.attach(time_signature, container[0])
    assert auxjad.inspect(container[:]).selection_is_full()
コード例 #22
0
def test_leaves_are_tieable_10():
    leaf = abjad.Note(r"c'2.")
    staff = abjad.Staff(r"c'4 ~ c'16")
    logical_tie = abjad.select(staff).logical_tie(0)
    assert auxjad.inspect([leaf, logical_tie]).leaves_are_tieable()
コード例 #23
0
def test_underfull_duration_03():
    container = abjad.Container(r"c'4 d'4 e'4 f'4")
    time_signature = abjad.TimeSignature((3, 4), partial=(1, 4))
    abjad.attach(time_signature, container[0])
    assert auxjad.inspect(container[:]).underfull_duration() == 0
コード例 #24
0
def test_leaves_are_tieable_08():
    staff = abjad.Staff(r"c'2 c'4. c'8")
    assert auxjad.inspect(staff[:]).leaves_are_tieable()
    staff = abjad.Staff(r"c'2 c'4. d'8")
    assert not auxjad.inspect(staff[:]).leaves_are_tieable()
コード例 #25
0
def test_leaves_are_tieable_09():
    leaf1 = abjad.Note(r"c'4")
    leaf2 = abjad.Note(r"c'4")
    leaf3 = abjad.Note(r"c'2.")
    assert auxjad.inspect([leaf1, leaf2, leaf3]).leaves_are_tieable()
コード例 #26
0
def test_selections_are_identical_11():
    container1 = abjad.Container(r"c'4 d'4 e'4 f'4")
    container2 = abjad.Staff(r"c'4 d'4 e'4 f'4")
    selections = [container1[:], container2[:]]
    assert auxjad.inspect(selections).selections_are_identical()
コード例 #27
0
def test_leaves_are_tieable_06():
    container = abjad.Container(r"r4 g'4 r2")
    leaves = [container[0], container[2]]
    assert not auxjad.inspect(leaves).leaves_are_tieable()
コード例 #28
0
def test_leaves_are_tieable_05():
    container = abjad.Container(r"r4 <c' e'>4 <c' e'>2")
    assert auxjad.inspect([container[1], container[2]]).leaves_are_tieable()
コード例 #29
0
def test_leaves_are_tieable_04():
    chord1 = abjad.Chord(r"<c' e' g'>4")
    chord2 = abjad.Chord(r"<c' e' g' bf'>4")
    assert not auxjad.inspect([chord1, chord2]).leaves_are_tieable()
コード例 #30
0
def test_underfull_duration_05():
    container = abjad.Container(r"\time 5/4 g''1 \time 4/4 f'1")
    with pytest.raises(ValueError):
        assert auxjad.inspect(container[:]).underfull_duration()