#
#   test_tempo_event.py
#   crest-python
#
#   Copyright (C) 2017 Rue Yokaze
#   Distributed under the MIT License.
#
import crest_loader
import unittest
from crest.events.meta import TempoEvent


class TestTempoEvent(unittest.TestCase):
    def test_ctor(self):
        TempoEvent()
        TempoEvent(120)

    def test_message(self):
        evt = TempoEvent(120)
        self.assertEqual(evt.Message, [0xFF, 0x51, 0x03, 0x07, 0xA1, 0x20])

    def test_property(self):
        evt = TempoEvent(120)
        self.assertEqual(evt.Tempo, 120)
        self.assertEqual(evt.MicroSeconds, 500000)
        evt.Tempo = 60
        self.assertEqual(evt.Tempo, 60)
        self.assertEqual(evt.MicroSeconds, 1000000)
        evt.MicroSeconds = 250000
        self.assertEqual(evt.Tempo, 240)
        self.assertEqual(evt.MicroSeconds, 250000)


if (__name__ == '__main__'):
    unittest.main()

[((35, 4, 35, 19), 'unittest.main', 'unittest.main', ({}, {}), '()', False, 'import unittest\n'), ((15, 8, 15, 20), 'crest.events.meta.TempoEvent', 'TempoEvent', ({}, {}), '()', False, 'from crest.events.meta import TempoEvent\n'), ((16, 8, 16, 23), 'crest.events.meta.TempoEvent', 'TempoEvent', ({(16, 19, 16, 22): '(120)'}, {}), '(120)', False, 'from crest.events.meta import TempoEvent\n'), ((19, 14, 19, 29), 'crest.events.meta.TempoEvent', 'TempoEvent', ({(19, 25, 19, 28): '120'}, {}), '(120)', False, 'from crest.events.meta import TempoEvent\n'), ((23, 14, 23, 29), 'crest.events.meta.TempoEvent', 'TempoEvent', ({(23, 25, 23, 28): '120'}, {}), '(120)', False, 'from crest.events.meta import TempoEvent\n')]