def test_encode_and_parse(): """Encode a message and then parse it. Should return the same message. """ note_on = Message('note_on') assert note_on == parse(note_on.bytes())
def test_encode_and_parse_all(): """Encode and then parse all message types. This checks mostly for errors in the parser. """ parser = Parser() for type_ in sorted(specs.SPEC_BY_TYPE.keys()): msg = Message(type_) parser.feed(msg.bytes()) parser.get_message() == msg assert parser.get_message() is None