'Verify MusicXML scale file.
Verify that it contains the correct pitches (sounding pitch) and durations.
Args:
filename: file to test.
part_name: name of the part the sequence is expected to contain.'

def checkFMajorScale(self, filename, part_name):

    expected_ns = common_testing_lib.parse_test_proto(music_pb2.NoteSequence, '\n                                ticks_per_quarter:    220\n                                source_info:    {\n                                        source_type:    SCORE_BASED\n                                        encoding_type:    MUSIC_XML\n                                        parser:    MAGENTA_MUSIC_XML\n                                }\n                                key_signatures    {\n                                        key:    F\n                                        time:    0\n                                }\n                                time_signatures    {\n                                        numerator:    4\n                                        denominator:    4\n                                }\n                                tempos    {\n                                        qpm:    120.0\n                                }\n                                total_time:    4.0\n                                ')
    part_info = expected_ns.part_infos.add()
    part_info.name = part_name
    expected_pitches = [65, 67, 69, 70, 72, 74, 76, 77]
    time = 0
    for pitch in expected_pitches:
        note = expected_ns.notes.add()
        note.part = 0
        note.voice = 1
        note.pitch = pitch
        note.start_time = time
        time += 0.5
        note.end_time = time
        note.velocity = 64
        note.numerator = 1
        note.denominator = 4
    source_musicxml = musicxml_parser.MusicXMLDocument(filename)
    sequence_proto = musicxml_reader.musicxml_to_sequence_proto(source_musicxml)
    self.assertProtoEquals(expected_ns, sequence_proto)
