def test_Container___getitem___06():
    """
    Bad name raises exception.
    """

    template = abjad.StringQuartetScoreTemplate()
    score = template()

    assert pytest.raises(Exception, "score['Foo']")
def test_Container___getitem___05():
    """
    Get one named component in subtree rooted at container.
    """

    template = abjad.StringQuartetScoreTemplate()
    score = template()

    assert score['First_Violin_Staff'].name == 'First_Violin_Staff'
    assert score['First_Violin_Voice'].name == 'First_Violin_Voice'
Пример #3
0
def test_Container___getitem___06():
    """
    Bad name raises exception.
    """

    template = abjad.StringQuartetScoreTemplate()
    score = template()

    with pytest.raises(Exception):
        score["Foo"]
def test_Container___getitem___07():
    """
    Duplicate named contexts raise exception.
    """

    template = abjad.StringQuartetScoreTemplate()
    score = template()

    assert score['First_Violin_Voice'].name == 'First_Violin_Voice'

    score['Cello_Staff'].append(abjad.Voice(name='First_Violin_Voice'))

    assert pytest.raises(Exception, "score['First_Violin_Voice']")

    extra_first_violin_voice = score['Cello_Staff'].pop()

    assert score['First_Violin_Voice'].name == 'First_Violin_Voice'
    assert score['First_Violin_Voice'] is not extra_first_violin_voice
Пример #5
0
def test_Container___getitem___07():
    """
    Duplicate named contexts raise exception.
    """

    template = abjad.StringQuartetScoreTemplate()
    score = template()

    assert score["First_Violin_Voice"].name == "First_Violin_Voice"

    score["Cello_Staff"].append(abjad.Voice(name="First_Violin_Voice"))

    with pytest.raises(Exception):
        score["First_Violin_Voice"]

    extra_first_violin_voice = score["Cello_Staff"].pop()

    assert score["First_Violin_Voice"].name == "First_Violin_Voice"
    assert score["First_Violin_Voice"] is not extra_first_violin_voice