'Test that meters are encoded properly.
Musical meters are expressed as a ratio of beats to divisions.
The MusicXML parser uses this ratio in lowest terms for timing
purposes. However, the meters should be in the actual terms
when appearing in a NoteSequence.'

def test_meter(self):

    ns = musicxml_reader.musicxml_file_to_sequence_proto(self.meter_test_filename)
    expected_ns = common_testing_lib.parse_test_proto(music_pb2.NoteSequence, '\n                                ticks_per_quarter:    220\n                                time_signatures    {\n                                        numerator:    1\n                                        denominator:    4\n                                }\n                                time_signatures    {\n                                        time:    0.5\n                                        numerator:    2\n                                        denominator:    4\n                                }\n                                time_signatures    {\n                                        time:    1.5\n                                        numerator:    3\n                                        denominator:    4\n                                }\n                                time_signatures    {\n                                        time:    3.0\n                                        numerator:    4\n                                        denominator:    4\n                                }\n                                time_signatures    {\n                                        time:    5.0\n                                        numerator:    5\n                                        denominator:    4\n                                }\n                                time_signatures    {\n                                        time:    7.5\n                                        numerator:    6\n                                        denominator:    4\n                                }\n                                time_signatures    {\n                                        time:    10.5\n                                        numerator:    7\n                                        denominator:    4\n                                }\n                                time_signatures    {\n                                        time:    14.0\n                                        numerator:    1\n                                        denominator:    8\n                                }\n                                time_signatures    {\n                                        time:    14.25\n                                        numerator:    2\n                                        denominator:    8\n                                }\n                                time_signatures    {\n                                        time:    14.75\n                                        numerator:    3\n                                        denominator:    8\n                                }\n                                time_signatures    {\n                                        time:    15.5\n                                        numerator:    4\n                                        denominator:    8\n                                }\n                                time_signatures    {\n                                        time:    16.5\n                                        numerator:    5\n                                        denominator:    8\n                                }\n                                time_signatures    {\n                                        time:    17.75\n                                        numerator:    6\n                                        denominator:    8\n                                }\n                                time_signatures    {\n                                        time:    19.25\n                                        numerator:    7\n                                        denominator:    8\n                                }\n                                time_signatures    {\n                                        time:    21.0\n                                        numerator:    8\n                                        denominator:    8\n                                }\n                                time_signatures    {\n                                        time:    23.0\n                                        numerator:    9\n                                        denominator:    8\n                                }\n                                time_signatures    {\n                                        time:    25.25\n                                        numerator:    10\n                                        denominator:    8\n                                }\n                                time_signatures    {\n                                        time:    27.75\n                                        numerator:    11\n                                        denominator:    8\n                                }\n                                time_signatures    {\n                                        time:    30.5\n                                        numerator:    12\n                                        denominator:    8\n                                }\n                                time_signatures    {\n                                        time:    33.5\n                                        numerator:    2\n                                        denominator:    2\n                                }\n                                time_signatures    {\n                                        time:    35.5\n                                        numerator:    3\n                                        denominator:    2\n                                }\n                                time_signatures    {\n                                        time:    38.5\n                                        numerator:    4\n                                        denominator:    2\n                                }\n                                time_signatures    {\n                                        time:    42.5\n                                        numerator:    4\n                                        denominator:    4\n                                }\n                                time_signatures    {\n                                        time:    44.5\n                                        numerator:    2\n                                        denominator:    2\n                                }\n                                key_signatures    {\n                                }\n                                tempos    {\n                                        qpm:    120\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        end_time:    0.5\n                                        numerator:    1\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    0.5\n                                        end_time:    1.5\n                                        numerator:    1\n                                        denominator:    2\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    1.5\n                                        end_time:    3.0\n                                        numerator:    3\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    3.0\n                                        end_time:    5.0\n                                        numerator:    1\n                                        denominator:    1\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    5.0\n                                        end_time:    6.5\n                                        numerator:    3\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    6.5\n                                        end_time:    7.5\n                                        numerator:    1\n                                        denominator:    2\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    7.5\n                                        end_time:    9.0\n                                        numerator:    3\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    9.0\n                                        end_time:    10.5\n                                        numerator:    3\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    10.5\n                                        end_time:    12.0\n                                        numerator:    3\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    12.0\n                                        end_time:    13.5\n                                        numerator:    3\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    13.5\n                                        end_time:    14.0\n                                        numerator:    1\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    14.0\n                                        end_time:    14.25\n                                        numerator:    1\n                                        denominator:    8\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    14.25\n                                        end_time:    14.75\n                                        numerator:    1\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    14.75\n                                        end_time:    15.5\n                                        numerator:    3\n                                        denominator:    8\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    15.5\n                                        end_time:    16.0\n                                        numerator:    1\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    16.0\n                                        end_time:    16.5\n                                        numerator:    1\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    16.5\n                                        end_time:    17.0\n                                        numerator:    1\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    17.0\n                                        end_time:    17.5\n                                        numerator:    1\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    17.5\n                                        end_time:    17.75\n                                        numerator:    1\n                                        denominator:    8\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    17.75\n                                        end_time:    18.5\n                                        numerator:    3\n                                        denominator:    8\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    18.5\n                                        end_time:    19.25\n                                        numerator:    3\n                                        denominator:    8\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    19.25\n                                        end_time:    20.0\n                                        numerator:    3\n                                        denominator:    8\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    20.0\n                                        end_time:    20.5\n                                        numerator:    1\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    20.5\n                                        end_time:    21.0\n                                        numerator:    1\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    21.0\n                                        end_time:    21.75\n                                        numerator:    3\n                                        denominator:    8\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    21.75\n                                        end_time:    22.5\n                                        numerator:    3\n                                        denominator:    8\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    22.5\n                                        end_time:    23.0\n                                        numerator:    1\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    23.0\n                                        end_time:    24.5\n                                        numerator:    3\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    24.5\n                                        end_time:    25.25\n                                        numerator:    3\n                                        denominator:    8\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    25.25\n                                        end_time:    26.75\n                                        numerator:    3\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    26.75\n                                        end_time:    27.25\n                                        numerator:    1\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    27.25\n                                        end_time:    27.75\n                                        numerator:    1\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    27.75\n                                        end_time:    29.25\n                                        numerator:    3\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    29.25\n                                        end_time:    30.0\n                                        numerator:    3\n                                        denominator:    8\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    30.0\n                                        end_time:    30.5\n                                        numerator:    1\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    30.5\n                                        end_time:    32.0\n                                        numerator:    3\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    32.0\n                                        end_time:    33.5\n                                        numerator:    3\n                                        denominator:    4\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    33.5\n                                        end_time:    34.5\n                                        numerator:    1\n                                        denominator:    2\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    34.5\n                                        end_time:    35.5\n                                        numerator:    1\n                                        denominator:    2\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    35.5\n                                        end_time:    36.5\n                                        numerator:    1\n                                        denominator:    2\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    36.5\n                                        end_time:    37.5\n                                        numerator:    1\n                                        denominator:    2\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    37.5\n                                        end_time:    38.5\n                                        numerator:    1\n                                        denominator:    2\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    38.5\n                                        end_time:    40.5\n                                        numerator:    1\n                                        denominator:    1\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    40.5\n                                        end_time:    42.5\n                                        numerator:    1\n                                        denominator:    1\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    42.5\n                                        end_time:    44.5\n                                        numerator:    1\n                                        denominator:    1\n                                        voice:    1\n                                }\n                                notes    {\n                                        pitch:    72\n                                        velocity:    64\n                                        start_time:    44.5\n                                        end_time:    46.5\n                                        numerator:    1\n                                        denominator:    1\n                                        voice:    1\n                                }\n                                total_time:    46.5\n                                part_infos    {\n                                        name:    "Flute"\n                                }\n                                source_info    {\n                                        source_type:    SCORE_BASED\n                                        encoding_type:    MUSIC_XML\n                                        parser:    MAGENTA_MUSIC_XML\n                                }\n                                ')
    self.assertProtoEquals(expected_ns, ns)
