def test_bwv2(self): path = u'vis/tests/corpus/bwv2.xml' expected_title = u'bwv2' expected_parts = [u'Soprano', u'Alto', u'Tenor', u'Bass'] the_score = music21.converter.parse(path) actual_title = _find_piece_title(the_score) actual_parts = _find_part_names(the_score) self.assertEqual(expected_title, actual_title) self.assertSequenceEqual(expected_parts, actual_parts)
def test_sinfony(self): path = u'vis/tests/corpus/sinfony.md' expected_title = u'Messiah' expected_parts = [u'Violino I', u'Violino II', u'Viola', u'Bassi'] the_score = music21.converter.parse(path) actual_title = _find_piece_title(the_score) actual_parts = _find_part_names(the_score) self.assertEqual(expected_title, actual_title) self.assertSequenceEqual(expected_parts, actual_parts)
def test_opus76(self): path = u'vis/tests/corpus/sqOp76-4-i.midi' expected_title = u'sqOp76-4-i' expected_parts = [u'Part 1', u'Part 2', u'Part 3', u'Part 4'] the_score = music21.converter.parse(path) actual_title = _find_piece_title(the_score) actual_parts = _find_part_names(the_score) self.assertEqual(expected_title, actual_title) self.assertSequenceEqual(expected_parts, actual_parts)
def test_kyrie(self): path = u'vis/tests/corpus/Kyrie.krn' expected_title = u'Kyrie' expected_parts = [u'spine_4', u'spine_3', u'spine_2', u'spine_1', u'spine_0'] the_score = music21.converter.parse(path) actual_title = _find_piece_title(the_score) actual_parts = _find_part_names(the_score) self.assertEqual(expected_title, actual_title) self.assertSequenceEqual(expected_parts, actual_parts)
def test_madrigal51(self): path = u'vis/tests/corpus/madrigal51.mxl' expected_title = u'madrigal51' expected_parts = [u'Canto', u'Alto', u'Tenor', u'Quinto', u'Basso', u'Continuo'] the_score = music21.converter.parse(path) actual_title = _find_piece_title(the_score) actual_parts = _find_part_names(the_score) self.assertEqual(expected_title, actual_title) self.assertSequenceEqual(expected_parts, actual_parts)
def test_opus76(self): path = os.path.join(VIS_PATH, 'tests', 'corpus', 'sqOp76-4-i.midi') expected_title = 'sqOp76-4-i' expected_parts = ['Part 1', 'Part 2', 'Part 3', 'Part 4'] the_score = Importer(path)._score actual_title = _find_piece_title(the_score) actual_parts = _find_part_names(the_score.parts) self.assertEqual(expected_title, actual_title) self.assertSequenceEqual(expected_parts, actual_parts)
def test_bwv2(self): path = os.path.join(VIS_PATH, 'tests', 'corpus', 'bwv2.xml') expected_title = 'bwv2' expected_parts = ['Soprano', 'Alto', 'Tenor', 'Bass'] the_score = Importer(path)._score actual_title = _find_piece_title(the_score) actual_parts = _find_part_names(the_score.parts) self.assertEqual(expected_title, actual_title) self.assertSequenceEqual(expected_parts, actual_parts)
def test_jos2308_krn(self): path = os.path.join(VIS_PATH, 'tests', 'corpus', 'Jos2308.krn') expected_title = 'Jos2308' expected_parts = ['spine_3', 'spine_2', 'spine_1', 'spine_0'] the_score = Importer(path)._score actual_title = _find_piece_title(the_score) actual_parts = _find_part_names(the_score) self.assertEqual(expected_title, actual_title) self.assertSequenceEqual(expected_parts, actual_parts)
def test_sinfony(self): path = os.path.join(VIS_PATH, 'tests', 'corpus', 'sinfony.md') expected_title = 'Messiah' expected_parts = ['Violino I', 'Violino II', 'Viola', 'Bassi'] the_score = Importer(path)._score actual_title = _find_piece_title(the_score) actual_parts = _find_part_names(the_score.parts) self.assertEqual(expected_title, actual_title) self.assertSequenceEqual(expected_parts, actual_parts)
def test_note_rest_indexer_2(self): # When the part has no Note or Rest objects in it. Really this is a test for the methods between # _get_part_streams() and _get_noterest(). expected = pandas.DataFrame({'Part 1': pandas.Series()}) test_part = stream.Part() # add stuff to the test_part for i in range(1000): add_me = clef.BassClef() add_me.offset = i test_part.append(add_me) add_me = bar.Barline() add_me.offset = i test_part.append(add_me) ip = IndexedPiece() ip._analyses['part_streams'] = [test_part] ip.metadata('parts', _find_part_names(ip._analyses['part_streams'])) actual = ip.get_data('noterest')['noterest.NoteRestIndexer'] self.assertTrue(actual.equals(expected))