Beispiel #1
0
class TestXMLPartList(TestCase):
    def setUp(self):
        self.part_list = PartList()
        score_part = ScorePart(id='p1')
        score_part.add_child(PartName(name="part"))
        self.part_list.add_child(score_part)

    def test_xml_part_list(self):
        result = '<part-list>\n  <score-part id="p1">\n    <part-name>part</part-name>\n  </score-part>\n</part-list>\n'
        self.assertEqual(self.part_list.to_string(), result)
Beispiel #2
0
    def test_1(self):
        pl = PartList()
        pl.add_child(generate_score_part('p1'))
        pl.add_child(generate_score_part('p2'))
        result = pl.to_string()
        expected = '''<part-list>
  <score-part id="p1">
    <part-name>p1</part-name>
  </score-part>
  <score-part id="p2">
    <part-name>p2</part-name>
  </score-part>
</part-list>
'''
        self.assertEqual(expected, result)
Beispiel #3
0
 def setUp(self) -> None:
     self.score = timewise.Score()
     pl = self.score.add_child(PartList())
     sp = pl.add_child(ScorePart(id='p1'))
     sp.add_child(PartName(name='none'))
     m = self.score.add_child(timewise.Measure(number=1))
     m.add_child(timewise.Part(id='p1'))
Beispiel #4
0
    def setUp(self):
        self.score = Score()
        self.score.version = '3.0'
        part_list = self.score.add_child(PartList())
        score_part = part_list.add_child(ScorePart(id='P1'))
        score_part.add_child(PartName(name="Oboe"))
        score_part.add_child(PartAbbreviation("Ob."))

        measure = self.score.add_child(Measure(number='1'))
        part = measure.add_child(Part(id='P1'))
        attributes = part.add_child(Attributes())
        attributes.add_child(Divisions(2))
        time = attributes.add_child(Time())
        time.add_child(Beats(4))
        time.add_child(BeatType(4))
        clef = attributes.add_child(Clef())
        clef.add_child(Sign('G'))
        clef.add_child(Line(2))
        note = part.add_child(Note())
        note.add_child(Rest(measure='yes'))
        note.add_child(Duration(8))

        measure = self.score.add_child(Measure(number='2'))
        part = measure.add_child(Part(id='P1'))
        attributes = part.add_child(Attributes())
        attributes.add_child(Divisions(2))
        note = part.add_child(Note())
        note.add_child(Rest(measure='yes'))
        note.add_child(Duration(8))
Beispiel #5
0
    def test_2(self):
        pl = PartList()
        pl.add_child(PartGroup(type='start'))
        pl.add_child(generate_score_part('p1'))
        pl.add_child(generate_score_part('p2'))
        result = pl.to_string()
        expected = '''<part-list>
  <part-group number="1" type="start"/>
  <score-part id="p1">
    <part-name>p1</part-name>
  </score-part>
  <score-part id="p2">
    <part-name>p2</part-name>
  </score-part>
</part-list>
'''
        self.assertEqual(expected, result)
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._part_list = self.add_child(PartList())
        self.version = '3.0'
        self._tuplet_line_width = None
        self._finished = False
        self._pre_quantized = False
        self._quantized = False
        self._post_quantized = False
        self._max_division = None
        self._forbidden_divisions = None
        self._page_style = TreePageStyle(score=self, **kwargs)
        self._accidental_mode = 'normal'
        self._break_beam_32 = False
        self._title = None
        self._subtitle = None
        self._composer = None
        self._page_number = None

        self._identifications_added = False
Beispiel #7
0
    def setUp(self):
        self.score = Score()
        self.score.version = '3.0'
        part_list = self.score.add_child(PartList())
        score_part = part_list.add_child(ScorePart(id='P1'))
        score_part.add_child(PartName(name="Oboe", print_object='yes'))

        part = self.score.add_child(Part(id='P1'))
        measure = part.add_child(Measure(number='1'))
        attributes = measure.add_child(Attributes())
        attributes.add_child(Divisions(1))
        time = attributes.add_child(Time())
        time.add_child(Beats(4))
        time.add_child(BeatType(4))
        clef = attributes.add_child(Clef())
        clef.add_child(Sign('G'))
        clef.add_child(Line(2))
        note = measure.add_child(Note())
        note.add_child(Pitch())
        note.add_child(Duration(4))
Beispiel #8
0
 def setUp(self):
     self.part_list = PartList()
     score_part = ScorePart(id='p1')
     score_part.add_child(PartName(name="part"))
     self.part_list.add_child(score_part)
Beispiel #9
0
    def test_4(self):
        pl = PartList()
        pl.add_child(generate_score_part('p1'))
        pl.goto_next_dtd_choice()
        pl.add_child(PartGroup(type='start'))
        pl.add_child(generate_score_part('p2'))
        pl.add_child(generate_score_part('p3'))
        pl.add_child(generate_score_part('p4'))
        pl.add_child(PartGroup(type='stop'))
        pl.add_child(generate_score_part('p5'))
        result = pl.to_string()
        expected = '''<part-list>
  <score-part id="p1">
    <part-name>p1</part-name>
  </score-part>
  <part-group number="1" type="start"/>
  <score-part id="p2">
    <part-name>p2</part-name>
  </score-part>
  <score-part id="p3">
    <part-name>p3</part-name>
  </score-part>
  <score-part id="p4">
    <part-name>p4</part-name>
  </score-part>
  <part-group number="1" type="stop"/>
  <score-part id="p5">
    <part-name>p5</part-name>
  </score-part>
</part-list>
'''
        self.assertEqual(expected, result)