def test_serialize_and_parse(): """ Serialize a message and parse it. Should return the same message. """ msg1 = protomidi.msg.note_on msg2 = protomidi.parse(protomidi.serialize(msg1))[0] assert msg2 == msg1
def test_pitchwheel_max(): """ Check if pitchwheel with maximal value serializes correctly. """ msg = protomidi.msg.pitchwheel(value=protomidi.msg.pitchwheel_max) bytes = protomidi.serialize(msg) assert bytes[1] == bytes[2] == 127
def test_pitchwheel_serialize_parse(): """ Check if pitchwheel with maximal value serializes correctly. """ msg1 = protomidi.msg.pitchwheel(value=0) bytes = protomidi.serialize(msg1) msg2 = protomidi.parse(bytes)[0] assert msg1 == msg2