Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_Chord___init___10():
"""
Initialize chord from containerized skip.
"""
tuplet = abjad.Voice("s8 s8 s8")
chord = abjad.Chord(tuplet[0])
assert format(chord) == "<>8"
assert abjad.inspect(chord).parentage().parent is None
assert abjad.inspect(chord).wellformed()
def test_Container___setitem___06():
"""
Replaces in-score container with out-of-score leaf.
"""
voice = abjad.Voice(2 * abjad.Container("c'8 c'8 c'8 c'8"))
voice = abjad.Voice("{ c'8 d'8 e'8 f'8 } { g'8 a'8 b'8 c''8 }")
assert format(voice) == abjad.String.normalize(
r"""
\new Voice
{
{
c'8
d'8
e'8
f'8
}
{
g'8
a'8
b'8
c''8
def test_Inspection_leaf_20():
"""
Noncontiguous or broken logical voices do not connect.
"""
voice_1 = abjad.Voice([abjad.Note(i, (1, 8)) for i in range(3)])
voice_1.name = "My Voice"
voice_2 = abjad.Voice([abjad.Note(i, (1, 8)) for i in range(4, 8)])
voice_2.name = "Your Voice"
voice_3 = abjad.Voice([abjad.Note(i, (1, 8)) for i in range(4, 8)])
voice_3.name = "My Voice"
staff = abjad.Staff([voice_1, voice_2, voice_3])
assert format(staff) == abjad.String.normalize(
r"""
\new Staff
{
\context Voice = "My Voice"
{
c'8
cs'8
d'8
def test_Container___delitem___04():
"""
Delete slice at beginning of container.
"""
voice = abjad.Voice("c'8 [ d'8 e'8 f'8 ]")
del voice[:2]
assert format(voice) == abjad.String.normalize(
r"""
\new Voice
{
e'8
f'8
]
}
"""
)
assert abjad.inspect(voice).wellformed()
abjad.beam(voice_1[:])
assert format(voice_1) == abjad.String.normalize(
r"""
\new Voice
{
c'8
[
d'8
e'8
]
}
"""
), print(format(voice_1))
voice_2 = abjad.Voice("c'8 d'8 e'8 f'8")
abjad.beam(voice_2[:])
assert format(voice_2) == abjad.String.normalize(
r"""
\new Voice
{
c'8
[
d'8
e'8
f'8
]
}
"""
), print(format(voice_2))
def test_Inspection_leaf_25():
"""
Returns none on nested differently named voices.
"""
inner_voice = abjad.Voice([abjad.Note(i, (1, 8)) for i in range(3)])
inner_voice.name = "Your Voice"
outer_voice = abjad.Voice([inner_voice, abjad.Note(3, (1, 8))])
outer_voice.name = "My Voice"
assert format(outer_voice) == abjad.String.normalize(
r"""
\context Voice = "My Voice"
{
\context Voice = "Your Voice"
{
c'8
cs'8
d'8
}
ef'8
}
"""
)
upper_measures[0].extend([abjad.Note(i, (1, 8)) for i in [9, 7, 5, 4]])
upper_measures[1].extend(
scoretools.make_notes([2, 7, 5, 4, 2], [(1, 4)] + [(1, 8)] * 4)
)
notes = scoretools.make_notes(
[0, 2, 4, 5, 4], [(1, 8), (1, 16), (1, 16), (1, 8), (1, 8)]
)
upper_measures[2].extend(notes)
upper_measures[3].append(abjad.Note(2, (1, 2)))
upper_measures[4].append(abjad.Note(2, (1, 2)))
# add notes to lower measures
v2 = abjad.Voice(scoretools.make_notes([-1, 2, 0], [(1, 4), (1, 8), (1, 8)]))
v2[1].dynamics.mark = "pp"
v2.name = "v2"
lower_measures[0].append(v2)
v2 = abjad.Voice(
scoretools.make_notes(
[-1, -3, -4, 0, -2], [(1, 8), (1, 8), (1, 4), (1, 8), (1, 8)]
)
)
v2[3].dynamics.mark = "mp"
v2.name = "v2"
lower_measures[1].append(v2)
v2 = Voice(
scoretools.make_notes(
[-3, -5, -6, -5, -3], [(1, 8), (1, 8), (1, 8), (1, 16), (1, 16)]
def make_spanner_score_06(self):
"""
Make 200-note voice with slur spanner on every 100 notes.
2.12 (r9724) initialization: 249,339 function calls
2.12 (r9703) LilyPond format: 121,497 function calls
2.12 (r9724) LilyPond format: 106,718 function calls
"""
import abjad
voice = abjad.Voice(200 * abjad.Note("c'16"))
for part in abjad.sequence(voice[:]).partition_by_counts(
[100],
cyclic=True,
):
slur = abjad.Slur()
abjad.attach(slur, part)
return voice
def make_spanner_score_03(self):
"""
Make 200-note voice with durated complex beam spanner
on every 100 notes.
2.12 (r9710) initialization: 251,606 function calls
2.12 (r9724) initialization: 249,369 function calls
2.12 (r9703) LilyPond format: 509,752 function calls
2.12 (r9710) LilyPond format: 510,556 function calls
2.12 (r9724) LilyPond format: 525,463 function calls
"""
import abjad
voice = abjad.Voice(200 * abjad.Note("c'16"))
for part in abjad.sequence(voice[:]).partition_by_counts(
[100],
cyclic=True,
):
beam = abjad.DuratedComplexBeam()
abjad.attach(beam, part)
return voice
Returns score.
"""
import abjad
# GLOBAL CONTEXT
global_context = self._make_global_context()
# RH STAFF
rh_voice = abjad.Voice(name='RHVoice')
rh_staff = abjad.Staff(
[rh_voice],
name='RHStaff',
)
# LH STAFF
lh_voice = abjad.Voice(name='LHVoice')
lh_staff = abjad.Staff(
[lh_voice],
name='LHStaff',
)
abjad.annotate(
lh_staff,
'default_clef',
abjad.Clef('bass'),
)
# PIANO STAFF
staff_group = abjad.StaffGroup(
[rh_staff, lh_staff],
lilypond_type='PianoStaff',
name='PianoStaff',
)